{"cells":[{"cell_type":"markdown","id":"moving-equivalent","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"04FBC5E87A0F40EF92ABB14565212A83","trusted":true,"mdEditEnable":false},"source":"## 模型预测\n* 在模型预测这个文件中我们在后面使用了6个模型，一起预测，所以使用基础镜像的话可能会比较慢，所以建议使用数据科学的镜像"},{"cell_type":"markdown","id":"governmental-plymouth","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"1C535661B3BA40AD9B59F0552AC22F75","trusted":true,"mdEditEnable":false},"source":"我们使用机器学习中模型数据对国民经济数据预测，导入相应的库\n在这里我们使用到xgboost库，所以没有的话需要安装"},{"metadata":{"id":"BE84A66BEB964FF582C688D3FA244230","notebookId":"60b349d74223f3001719c3bd","jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"trusted":true,"collapsed":false,"scrolled":false},"cell_type":"code","outputs":[{"output_type":"stream","text":"Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple\nCollecting xgboost\n\u001b[?25l  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/bb/35/169eec194bf1f9ef52ed670f5032ef2abaf6ed285cfadcb4b6026b800fc9/xgboost-1.4.2-py3-none-manylinux2010_x86_64.whl (166.7MB)\n\u001b[K     |████████████████████████████████| 166.7MB 29.9MB/s eta 0:00:01  |█▍                              | 7.2MB 1.5MB/s eta 0:01:43     |█████████████▎                  | 69.4MB 3.7MB/s eta 0:00:27     |████████████████▍               | 85.6MB 68.7MB/s eta 0:00:02\n\u001b[?25hRequirement already satisfied: scipy in /opt/conda/lib/python3.7/site-packages (from xgboost) (1.3.1)\nRequirement already satisfied: numpy in /opt/conda/lib/python3.7/site-packages (from xgboost) (1.17.2)\nInstalling collected packages: xgboost\nSuccessfully installed xgboost-1.4.2\n","name":"stdout"}],"source":"!pip install xgboost  -i https://pypi.tuna.tsinghua.edu.cn/simple","execution_count":1},{"cell_type":"markdown","id":"applied-assignment","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"994E5E26662F421F8C1E1C64394D547B","trusted":true,"collapsed":false,"scrolled":false,"mdEditEnable":false},"source":"### 一、导入数据\n"},{"metadata":{"id":"543D17940A7044278C02F2D80C3F49D0","notebookId":"60b349d74223f3001719c3bd","jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"trusted":true,"collapsed":false,"scrolled":false},"cell_type":"code","outputs":[],"source":"# 导入需要的库\nimport pandas as pd\nimport sklearn as skr\nimport numpy as np\nimport datetime\nimport matplotlib.pyplot as plt\nimport seaborn as sns\nfrom dateutil.relativedelta import relativedelta\nfrom typing import *\nimport random\nfrom sklearn.metrics import mean_squared_error\nfrom sklearn.metrics import mean_absolute_error\nfrom sklearn.linear_model import LinearRegression\nfrom sklearn.tree import DecisionTreeRegressor\nfrom sklearn.ensemble import RandomForestRegressor\nfrom sklearn.ensemble import GradientBoostingRegressor\nfrom sklearn.neural_network import MLPRegressor\nimport xgboost as xgb\nimport warnings\nwarnings.filterwarnings('ignore')\nnp.random.seed(1024)","execution_count":2},{"cell_type":"code","execution_count":3,"id":"backed-fifteen","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"2976D94F591A46C9902591A0AE167E53","trusted":true,"collapsed":false,"scrolled":false},"outputs":[],"source":"# 分割数据集数据分割，在国民经济数据中分为：10—20年数据为训练集，21年为测试集  \ndef split_data(data: pd.DataFrame)->pd.DataFrame:\n    trainset = data[(datetime.datetime(2010,1,1) <= data['Month']) & (data['Month'] < datetime.datetime(2020,12,1))]\n    testset = data[(datetime.datetime(2020,1,1) <= data['Month']) & (data['Month'] < datetime.datetime(2020,12,1))]\n    return trainset, testset"},{"cell_type":"code","execution_count":4,"id":"honest-peter","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"6F0BC36D47164D00BB547546DEDC85EE","trusted":true,"collapsed":false,"scrolled":false},"outputs":[],"source":"# 模型训练\ndef generate_result(df: pd.DataFrame, feature: Iterable, model = LinearRegression(), target:str = 'Current_Export')->Iterable:\n    trainset, testset = split_data(df)\n    model.fit(X=trainset[feature], y=trainset[target])\n    result_lr = model.predict(testset[feature])\n    return result_lr"},{"cell_type":"markdown","id":"assisted-class","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"531F0B11185041468D622E25D63A6873","trusted":true,"mdEditEnable":false},"source":"### 二、定义模型评估指标  \n对于回归模型，我们一般使用均方误差对模型来做评估，所以在这里我们也是用均方误差来评价"},{"cell_type":"code","execution_count":5,"id":"plastic-china","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"621397A8416E4445B204265D5A13B8E5","trusted":true,"collapsed":false,"scrolled":false},"outputs":[],"source":"from sklearn.metrics import mean_squared_error\ndef score_test(target,test_targe):\n    score = mean_squared_error(test_targe,target)\n    print(\"score:\",score)"},{"cell_type":"code","execution_count":6,"id":"peripheral-panel","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"D8D6D117F22647E7852D337D5239DA87","trusted":true,"collapsed":false,"scrolled":false},"outputs":[],"source":"dataset=pd.read_csv(\"./特征工程/base_Current_Export.csv\")"},{"cell_type":"code","execution_count":7,"id":"minimal-agreement","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"AE1DE44BF77F4BDE84FB2D92340BDFCE","trusted":true,"collapsed":true,"scrolled":false},"outputs":[{"output_type":"stream","text":"<class 'pandas.core.frame.DataFrame'>\nRangeIndex: 180 entries, 0 to 179\nData columns (total 23 columns):\nCurrent_Export__sum_values                                                158 non-null float64\nCurrent_Export__cwt_coefficients__coeff_0__w_20__widths_(2, 5, 10, 20)    158 non-null float64\nCurrent_Export__cwt_coefficients__coeff_0__w_10__widths_(2, 5, 10, 20)    158 non-null float64\nCurrent_Export__cwt_coefficients__coeff_0__w_5__widths_(2, 5, 10, 20)     158 non-null float64\nCurrent_Export__cwt_coefficients__coeff_0__w_2__widths_(2, 5, 10, 20)     158 non-null float64\nCurrent_Export__quantile__q_0.9                                           158 non-null float64\nCurrent_Export__quantile__q_0.8                                           158 non-null float64\nCurrent_Export__quantile__q_0.7                                           158 non-null float64\nCurrent_Export__quantile__q_0.6                                           158 non-null float64\nCurrent_Export__fft_coefficient__attr_\"real\"__coeff_0                     158 non-null float64\nCurrent_Export__quantile__q_0.4                                           158 non-null float64\nCurrent_Export__quantile__q_0.2                                           158 non-null float64\nCurrent_Export__quantile__q_0.1                                           158 non-null float64\nCurrent_Export__minimum                                                   158 non-null float64\nCurrent_Export__maximum                                                   158 non-null float64\nCurrent_Export__mean                                                      158 non-null float64\nCurrent_Export__median                                                    158 non-null float64\nCurrent_Export__abs_energy                                                158 non-null float64\nCurrent_Export__quantile__q_0.3                                           158 non-null float64\nCurrent_Export__fft_coefficient__attr_\"abs\"__coeff_0                      158 non-null float64\nCurrent_Export__benford_correlation                                       158 non-null float64\nMonth                                                                     180 non-null object\nCurrent_Export                                                            158 non-null float64\ndtypes: float64(22), object(1)\nmemory usage: 32.5+ KB\n","name":"stdout"}],"source":"dataset.info()"},{"cell_type":"code","execution_count":8,"id":"physical-swiss","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"32E182C0A6EA47578DB6FBFDE43B1528","trusted":true,"collapsed":false,"scrolled":false},"outputs":[],"source":"dataset[\"Month\"]=pd.to_datetime(dataset[\"Month\"])"},{"cell_type":"code","execution_count":9,"id":"compressed-mustang","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"21DEB8991C5F4B1FBFB9D649347C2267","trusted":true,"collapsed":false,"scrolled":false},"outputs":[],"source":"dataset=dataset.set_index(\"Month\")"},{"cell_type":"code","execution_count":10,"id":"korean-china","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"DE56FD32D9D74C6497F7802CE27D1456","trusted":true,"collapsed":false,"scrolled":false},"outputs":[],"source":"# 选取特征\nlabels=[ i for i in dataset.columns  if i not in [\"Month\",\"Current_Export\"]]"},{"cell_type":"code","execution_count":11,"id":"stuck-electric","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"0C7374D020BC4F4B8254B75635B831F8","trusted":true,"collapsed":false,"scrolled":false},"outputs":[],"source":"# 时间序列的机器学习模型构建，我们需要考虑时间的滞后性，为达到一年数据的预测，滞后了一年的数据\ndata=dataset[labels].shift(12)"},{"cell_type":"code","execution_count":12,"id":"patent-shakespeare","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"E67B0BA967B1443A8CC77312BD6F4273","trusted":true,"collapsed":false,"scrolled":true},"outputs":[{"output_type":"execute_result","metadata":{},"data":{"text/plain":"            Current_Export__sum_values  \\\nMonth                                    \n2008-01-01                         NaN   \n2008-02-01                         NaN   \n2008-03-01                         NaN   \n2008-04-01                         NaN   \n2008-05-01                         NaN   \n2008-06-01                         NaN   \n2008-07-01                         NaN   \n2008-08-01                         NaN   \n2008-09-01                         NaN   \n2008-10-01                         NaN   \n2008-11-01                         NaN   \n2008-12-01                         NaN   \n2009-01-01                      1096.0   \n2009-02-01                       873.7   \n2009-03-01                      1090.0   \n2009-04-01                      1187.0   \n2009-05-01                      1205.0   \n2009-06-01                      1212.0   \n2009-07-01                      1367.0   \n2009-08-01                      1349.0   \n\n            Current_Export__cwt_coefficients__coeff_0__w_20__widths_(2, 5, 10, 20)  \\\nMonth                                                                                \n2008-01-01                                                NaN                        \n2008-02-01                                                NaN                        \n2008-03-01                                                NaN                        \n2008-04-01                                                NaN                        \n2008-05-01                                                NaN                        \n2008-06-01                                                NaN                        \n2008-07-01                                                NaN                        \n2008-08-01                                                NaN                        \n2008-09-01                                                NaN                        \n2008-10-01                                                NaN                        \n2008-11-01                                                NaN                        \n2008-12-01                                                NaN                        \n2009-01-01                                         212.558001                        \n2009-02-01                                         169.445187                        \n2009-03-01                                         211.394362                        \n2009-04-01                                         230.206521                        \n2009-05-01                                         233.697437                        \n2009-06-01                                         235.055015                        \n2009-07-01                                         265.115682                        \n2009-08-01                                         261.624765                        \n\n            Current_Export__cwt_coefficients__coeff_0__w_10__widths_(2, 5, 10, 20)  \\\nMonth                                                                                \n2008-01-01                                                NaN                        \n2008-02-01                                                NaN                        \n2008-03-01                                                NaN                        \n2008-04-01                                                NaN                        \n2008-05-01                                                NaN                        \n2008-06-01                                                NaN                        \n2008-07-01                                                NaN                        \n2008-08-01                                                NaN                        \n2008-09-01                                                NaN                        \n2008-10-01                                                NaN                        \n2008-11-01                                                NaN                        \n2008-12-01                                                NaN                        \n2009-01-01                                         300.602407                        \n2009-02-01                                         239.631682                        \n2009-03-01                                         298.956774                        \n2009-04-01                                         325.561184                        \n2009-05-01                                         330.498085                        \n2009-06-01                                         332.417991                        \n2009-07-01                                         374.930192                        \n2009-08-01                                         369.993292                        \n\n            Current_Export__cwt_coefficients__coeff_0__w_5__widths_(2, 5, 10, 20)  \\\nMonth                                                                               \n2008-01-01                                                NaN                       \n2008-02-01                                                NaN                       \n2008-03-01                                                NaN                       \n2008-04-01                                                NaN                       \n2008-05-01                                                NaN                       \n2008-06-01                                                NaN                       \n2008-07-01                                                NaN                       \n2008-08-01                                                NaN                       \n2008-09-01                                                NaN                       \n2008-10-01                                                NaN                       \n2008-11-01                                                NaN                       \n2008-12-01                                                NaN                       \n2009-01-01                                         425.116001                       \n2009-02-01                                         338.890374                       \n2009-03-01                                         422.788724                       \n2009-04-01                                         460.413042                       \n2009-05-01                                         467.394874                       \n2009-06-01                                         470.110031                       \n2009-07-01                                         530.231363                       \n2009-08-01                                         523.249531                       \n\n            Current_Export__cwt_coefficients__coeff_0__w_2__widths_(2, 5, 10, 20)  \\\nMonth                                                                               \n2008-01-01                                                NaN                       \n2008-02-01                                                NaN                       \n2008-03-01                                                NaN                       \n2008-04-01                                                NaN                       \n2008-05-01                                                NaN                       \n2008-06-01                                                NaN                       \n2008-07-01                                                NaN                       \n2008-08-01                                                NaN                       \n2008-09-01                                                NaN                       \n2008-10-01                                                NaN                       \n2008-11-01                                                NaN                       \n2008-12-01                                                NaN                       \n2009-01-01                                         672.167417                       \n2009-02-01                                         535.832730                       \n2009-03-01                                         668.487668                       \n2009-04-01                                         727.976938                       \n2009-05-01                                         739.016184                       \n2009-06-01                                         743.309224                       \n2009-07-01                                         838.369397                       \n2009-08-01                                         827.330151                       \n\n            Current_Export__quantile__q_0.9  Current_Export__quantile__q_0.8  \\\nMonth                                                                          \n2008-01-01                              NaN                              NaN   \n2008-02-01                              NaN                              NaN   \n2008-03-01                              NaN                              NaN   \n2008-04-01                              NaN                              NaN   \n2008-05-01                              NaN                              NaN   \n2008-06-01                              NaN                              NaN   \n2008-07-01                              NaN                              NaN   \n2008-08-01                              NaN                              NaN   \n2008-09-01                              NaN                              NaN   \n2008-10-01                              NaN                              NaN   \n2008-11-01                              NaN                              NaN   \n2008-12-01                              NaN                              NaN   \n2009-01-01                           1096.0                           1096.0   \n2009-02-01                            873.7                            873.7   \n2009-03-01                           1090.0                           1090.0   \n2009-04-01                           1187.0                           1187.0   \n2009-05-01                           1205.0                           1205.0   \n2009-06-01                           1212.0                           1212.0   \n2009-07-01                           1367.0                           1367.0   \n2009-08-01                           1349.0                           1349.0   \n\n            Current_Export__quantile__q_0.7  Current_Export__quantile__q_0.6  \\\nMonth                                                                          \n2008-01-01                              NaN                              NaN   \n2008-02-01                              NaN                              NaN   \n2008-03-01                              NaN                              NaN   \n2008-04-01                              NaN                              NaN   \n2008-05-01                              NaN                              NaN   \n2008-06-01                              NaN                              NaN   \n2008-07-01                              NaN                              NaN   \n2008-08-01                              NaN                              NaN   \n2008-09-01                              NaN                              NaN   \n2008-10-01                              NaN                              NaN   \n2008-11-01                              NaN                              NaN   \n2008-12-01                              NaN                              NaN   \n2009-01-01                           1096.0                           1096.0   \n2009-02-01                            873.7                            873.7   \n2009-03-01                           1090.0                           1090.0   \n2009-04-01                           1187.0                           1187.0   \n2009-05-01                           1205.0                           1205.0   \n2009-06-01                           1212.0                           1212.0   \n2009-07-01                           1367.0                           1367.0   \n2009-08-01                           1349.0                           1349.0   \n\n            Current_Export__fft_coefficient__attr_\"real\"__coeff_0  ...  \\\nMonth                                                              ...   \n2008-01-01                                                NaN      ...   \n2008-02-01                                                NaN      ...   \n2008-03-01                                                NaN      ...   \n2008-04-01                                                NaN      ...   \n2008-05-01                                                NaN      ...   \n2008-06-01                                                NaN      ...   \n2008-07-01                                                NaN      ...   \n2008-08-01                                                NaN      ...   \n2008-09-01                                                NaN      ...   \n2008-10-01                                                NaN      ...   \n2008-11-01                                                NaN      ...   \n2008-12-01                                                NaN      ...   \n2009-01-01                                             1096.0      ...   \n2009-02-01                                              873.7      ...   \n2009-03-01                                             1090.0      ...   \n2009-04-01                                             1187.0      ...   \n2009-05-01                                             1205.0      ...   \n2009-06-01                                             1212.0      ...   \n2009-07-01                                             1367.0      ...   \n2009-08-01                                             1349.0      ...   \n\n            Current_Export__quantile__q_0.2  Current_Export__quantile__q_0.1  \\\nMonth                                                                          \n2008-01-01                              NaN                              NaN   \n2008-02-01                              NaN                              NaN   \n2008-03-01                              NaN                              NaN   \n2008-04-01                              NaN                              NaN   \n2008-05-01                              NaN                              NaN   \n2008-06-01                              NaN                              NaN   \n2008-07-01                              NaN                              NaN   \n2008-08-01                              NaN                              NaN   \n2008-09-01                              NaN                              NaN   \n2008-10-01                              NaN                              NaN   \n2008-11-01                              NaN                              NaN   \n2008-12-01                              NaN                              NaN   \n2009-01-01                           1096.0                           1096.0   \n2009-02-01                            873.7                            873.7   \n2009-03-01                           1090.0                           1090.0   \n2009-04-01                           1187.0                           1187.0   \n2009-05-01                           1205.0                           1205.0   \n2009-06-01                           1212.0                           1212.0   \n2009-07-01                           1367.0                           1367.0   \n2009-08-01                           1349.0                           1349.0   \n\n            Current_Export__minimum  Current_Export__maximum  \\\nMonth                                                          \n2008-01-01                      NaN                      NaN   \n2008-02-01                      NaN                      NaN   \n2008-03-01                      NaN                      NaN   \n2008-04-01                      NaN                      NaN   \n2008-05-01                      NaN                      NaN   \n2008-06-01                      NaN                      NaN   \n2008-07-01                      NaN                      NaN   \n2008-08-01                      NaN                      NaN   \n2008-09-01                      NaN                      NaN   \n2008-10-01                      NaN                      NaN   \n2008-11-01                      NaN                      NaN   \n2008-12-01                      NaN                      NaN   \n2009-01-01                   1096.0                   1096.0   \n2009-02-01                    873.7                    873.7   \n2009-03-01                   1090.0                   1090.0   \n2009-04-01                   1187.0                   1187.0   \n2009-05-01                   1205.0                   1205.0   \n2009-06-01                   1212.0                   1212.0   \n2009-07-01                   1367.0                   1367.0   \n2009-08-01                   1349.0                   1349.0   \n\n            Current_Export__mean  Current_Export__median  \\\nMonth                                                      \n2008-01-01                   NaN                     NaN   \n2008-02-01                   NaN                     NaN   \n2008-03-01                   NaN                     NaN   \n2008-04-01                   NaN                     NaN   \n2008-05-01                   NaN                     NaN   \n2008-06-01                   NaN                     NaN   \n2008-07-01                   NaN                     NaN   \n2008-08-01                   NaN                     NaN   \n2008-09-01                   NaN                     NaN   \n2008-10-01                   NaN                     NaN   \n2008-11-01                   NaN                     NaN   \n2008-12-01                   NaN                     NaN   \n2009-01-01                1096.0                  1096.0   \n2009-02-01                 873.7                   873.7   \n2009-03-01                1090.0                  1090.0   \n2009-04-01                1187.0                  1187.0   \n2009-05-01                1205.0                  1205.0   \n2009-06-01                1212.0                  1212.0   \n2009-07-01                1367.0                  1367.0   \n2009-08-01                1349.0                  1349.0   \n\n            Current_Export__abs_energy  Current_Export__quantile__q_0.3  \\\nMonth                                                                     \n2008-01-01                         NaN                              NaN   \n2008-02-01                         NaN                              NaN   \n2008-03-01                         NaN                              NaN   \n2008-04-01                         NaN                              NaN   \n2008-05-01                         NaN                              NaN   \n2008-06-01                         NaN                              NaN   \n2008-07-01                         NaN                              NaN   \n2008-08-01                         NaN                              NaN   \n2008-09-01                         NaN                              NaN   \n2008-10-01                         NaN                              NaN   \n2008-11-01                         NaN                              NaN   \n2008-12-01                         NaN                              NaN   \n2009-01-01                  1201216.00                           1096.0   \n2009-02-01                   763351.69                            873.7   \n2009-03-01                  1188100.00                           1090.0   \n2009-04-01                  1408969.00                           1187.0   \n2009-05-01                  1452025.00                           1205.0   \n2009-06-01                  1468944.00                           1212.0   \n2009-07-01                  1868689.00                           1367.0   \n2009-08-01                  1819801.00                           1349.0   \n\n            Current_Export__fft_coefficient__attr_\"abs\"__coeff_0  \\\nMonth                                                              \n2008-01-01                                                NaN      \n2008-02-01                                                NaN      \n2008-03-01                                                NaN      \n2008-04-01                                                NaN      \n2008-05-01                                                NaN      \n2008-06-01                                                NaN      \n2008-07-01                                                NaN      \n2008-08-01                                                NaN      \n2008-09-01                                                NaN      \n2008-10-01                                                NaN      \n2008-11-01                                                NaN      \n2008-12-01                                                NaN      \n2009-01-01                                             1096.0      \n2009-02-01                                              873.7      \n2009-03-01                                             1090.0      \n2009-04-01                                             1187.0      \n2009-05-01                                             1205.0      \n2009-06-01                                             1212.0      \n2009-07-01                                             1367.0      \n2009-08-01                                             1349.0      \n\n            Current_Export__benford_correlation  \nMonth                                            \n2008-01-01                                  NaN  \n2008-02-01                                  NaN  \n2008-03-01                                  NaN  \n2008-04-01                                  NaN  \n2008-05-01                                  NaN  \n2008-06-01                                  NaN  \n2008-07-01                                  NaN  \n2008-08-01                                  NaN  \n2008-09-01                                  NaN  \n2008-10-01                                  NaN  \n2008-11-01                                  NaN  \n2008-12-01                                  NaN  \n2009-01-01                             0.864123  \n2009-02-01                            -0.272809  \n2009-03-01                             0.864123  \n2009-04-01                             0.864123  \n2009-05-01                             0.864123  \n2009-06-01                             0.864123  \n2009-07-01                             0.864123  \n2009-08-01                             0.864123  \n\n[20 rows x 21 columns]","text/html":"<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Current_Export__sum_values</th>\n      <th>Current_Export__cwt_coefficients__coeff_0__w_20__widths_(2, 5, 10, 20)</th>\n      <th>Current_Export__cwt_coefficients__coeff_0__w_10__widths_(2, 5, 10, 20)</th>\n      <th>Current_Export__cwt_coefficients__coeff_0__w_5__widths_(2, 5, 10, 20)</th>\n      <th>Current_Export__cwt_coefficients__coeff_0__w_2__widths_(2, 5, 10, 20)</th>\n      <th>Current_Export__quantile__q_0.9</th>\n      <th>Current_Export__quantile__q_0.8</th>\n      <th>Current_Export__quantile__q_0.7</th>\n      <th>Current_Export__quantile__q_0.6</th>\n      <th>Current_Export__fft_coefficient__attr_\"real\"__coeff_0</th>\n      <th>...</th>\n      <th>Current_Export__quantile__q_0.2</th>\n      <th>Current_Export__quantile__q_0.1</th>\n      <th>Current_Export__minimum</th>\n      <th>Current_Export__maximum</th>\n      <th>Current_Export__mean</th>\n      <th>Current_Export__median</th>\n      <th>Current_Export__abs_energy</th>\n      <th>Current_Export__quantile__q_0.3</th>\n      <th>Current_Export__fft_coefficient__attr_\"abs\"__coeff_0</th>\n      <th>Current_Export__benford_correlation</th>\n    </tr>\n    <tr>\n      <th>Month</th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <td>2008-01-01</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>2008-02-01</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>2008-03-01</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>2008-04-01</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>2008-05-01</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>2008-06-01</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>2008-07-01</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>2008-08-01</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>2008-09-01</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>2008-10-01</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>2008-11-01</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>2008-12-01</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>2009-01-01</td>\n      <td>1096.0</td>\n      <td>212.558001</td>\n      <td>300.602407</td>\n      <td>425.116001</td>\n      <td>672.167417</td>\n      <td>1096.0</td>\n      <td>1096.0</td>\n      <td>1096.0</td>\n      <td>1096.0</td>\n      <td>1096.0</td>\n      <td>...</td>\n      <td>1096.0</td>\n      <td>1096.0</td>\n      <td>1096.0</td>\n      <td>1096.0</td>\n      <td>1096.0</td>\n      <td>1096.0</td>\n      <td>1201216.00</td>\n      <td>1096.0</td>\n      <td>1096.0</td>\n      <td>0.864123</td>\n    </tr>\n    <tr>\n      <td>2009-02-01</td>\n      <td>873.7</td>\n      <td>169.445187</td>\n      <td>239.631682</td>\n      <td>338.890374</td>\n      <td>535.832730</td>\n      <td>873.7</td>\n      <td>873.7</td>\n      <td>873.7</td>\n      <td>873.7</td>\n      <td>873.7</td>\n      <td>...</td>\n      <td>873.7</td>\n      <td>873.7</td>\n      <td>873.7</td>\n      <td>873.7</td>\n      <td>873.7</td>\n      <td>873.7</td>\n      <td>763351.69</td>\n      <td>873.7</td>\n      <td>873.7</td>\n      <td>-0.272809</td>\n    </tr>\n    <tr>\n      <td>2009-03-01</td>\n      <td>1090.0</td>\n      <td>211.394362</td>\n      <td>298.956774</td>\n      <td>422.788724</td>\n      <td>668.487668</td>\n      <td>1090.0</td>\n      <td>1090.0</td>\n      <td>1090.0</td>\n      <td>1090.0</td>\n      <td>1090.0</td>\n      <td>...</td>\n      <td>1090.0</td>\n      <td>1090.0</td>\n      <td>1090.0</td>\n      <td>1090.0</td>\n      <td>1090.0</td>\n      <td>1090.0</td>\n      <td>1188100.00</td>\n      <td>1090.0</td>\n      <td>1090.0</td>\n      <td>0.864123</td>\n    </tr>\n    <tr>\n      <td>2009-04-01</td>\n      <td>1187.0</td>\n      <td>230.206521</td>\n      <td>325.561184</td>\n      <td>460.413042</td>\n      <td>727.976938</td>\n      <td>1187.0</td>\n      <td>1187.0</td>\n      <td>1187.0</td>\n      <td>1187.0</td>\n      <td>1187.0</td>\n      <td>...</td>\n      <td>1187.0</td>\n      <td>1187.0</td>\n      <td>1187.0</td>\n      <td>1187.0</td>\n      <td>1187.0</td>\n      <td>1187.0</td>\n      <td>1408969.00</td>\n      <td>1187.0</td>\n      <td>1187.0</td>\n      <td>0.864123</td>\n    </tr>\n    <tr>\n      <td>2009-05-01</td>\n      <td>1205.0</td>\n      <td>233.697437</td>\n      <td>330.498085</td>\n      <td>467.394874</td>\n      <td>739.016184</td>\n      <td>1205.0</td>\n      <td>1205.0</td>\n      <td>1205.0</td>\n      <td>1205.0</td>\n      <td>1205.0</td>\n      <td>...</td>\n      <td>1205.0</td>\n      <td>1205.0</td>\n      <td>1205.0</td>\n      <td>1205.0</td>\n      <td>1205.0</td>\n      <td>1205.0</td>\n      <td>1452025.00</td>\n      <td>1205.0</td>\n      <td>1205.0</td>\n      <td>0.864123</td>\n    </tr>\n    <tr>\n      <td>2009-06-01</td>\n      <td>1212.0</td>\n      <td>235.055015</td>\n      <td>332.417991</td>\n      <td>470.110031</td>\n      <td>743.309224</td>\n      <td>1212.0</td>\n      <td>1212.0</td>\n      <td>1212.0</td>\n      <td>1212.0</td>\n      <td>1212.0</td>\n      <td>...</td>\n      <td>1212.0</td>\n      <td>1212.0</td>\n      <td>1212.0</td>\n      <td>1212.0</td>\n      <td>1212.0</td>\n      <td>1212.0</td>\n      <td>1468944.00</td>\n      <td>1212.0</td>\n      <td>1212.0</td>\n      <td>0.864123</td>\n    </tr>\n    <tr>\n      <td>2009-07-01</td>\n      <td>1367.0</td>\n      <td>265.115682</td>\n      <td>374.930192</td>\n      <td>530.231363</td>\n      <td>838.369397</td>\n      <td>1367.0</td>\n      <td>1367.0</td>\n      <td>1367.0</td>\n      <td>1367.0</td>\n      <td>1367.0</td>\n      <td>...</td>\n      <td>1367.0</td>\n      <td>1367.0</td>\n      <td>1367.0</td>\n      <td>1367.0</td>\n      <td>1367.0</td>\n      <td>1367.0</td>\n      <td>1868689.00</td>\n      <td>1367.0</td>\n      <td>1367.0</td>\n      <td>0.864123</td>\n    </tr>\n    <tr>\n      <td>2009-08-01</td>\n      <td>1349.0</td>\n      <td>261.624765</td>\n      <td>369.993292</td>\n      <td>523.249531</td>\n      <td>827.330151</td>\n      <td>1349.0</td>\n      <td>1349.0</td>\n      <td>1349.0</td>\n      <td>1349.0</td>\n      <td>1349.0</td>\n      <td>...</td>\n      <td>1349.0</td>\n      <td>1349.0</td>\n      <td>1349.0</td>\n      <td>1349.0</td>\n      <td>1349.0</td>\n      <td>1349.0</td>\n      <td>1819801.00</td>\n      <td>1349.0</td>\n      <td>1349.0</td>\n      <td>0.864123</td>\n    </tr>\n  </tbody>\n</table>\n<p>20 rows × 21 columns</p>\n</div>"},"execution_count":12}],"source":"data.head(20)"},{"cell_type":"code","execution_count":13,"id":"twenty-attention","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"C543D147605E4E5EAC3D80531AEF9A3A","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"execute_result","metadata":{},"data":{"text/plain":"            Current_Export__sum_values  \\\nMonth                                    \n2022-08-01                         NaN   \n2022-09-01                         NaN   \n2022-10-01                         NaN   \n2022-11-01                         NaN   \n2022-12-01                         NaN   \n\n            Current_Export__cwt_coefficients__coeff_0__w_20__widths_(2, 5, 10, 20)  \\\nMonth                                                                                \n2022-08-01                                                NaN                        \n2022-09-01                                                NaN                        \n2022-10-01                                                NaN                        \n2022-11-01                                                NaN                        \n2022-12-01                                                NaN                        \n\n            Current_Export__cwt_coefficients__coeff_0__w_10__widths_(2, 5, 10, 20)  \\\nMonth                                                                                \n2022-08-01                                                NaN                        \n2022-09-01                                                NaN                        \n2022-10-01                                                NaN                        \n2022-11-01                                                NaN                        \n2022-12-01                                                NaN                        \n\n            Current_Export__cwt_coefficients__coeff_0__w_5__widths_(2, 5, 10, 20)  \\\nMonth                                                                               \n2022-08-01                                                NaN                       \n2022-09-01                                                NaN                       \n2022-10-01                                                NaN                       \n2022-11-01                                                NaN                       \n2022-12-01                                                NaN                       \n\n            Current_Export__cwt_coefficients__coeff_0__w_2__widths_(2, 5, 10, 20)  \\\nMonth                                                                               \n2022-08-01                                                NaN                       \n2022-09-01                                                NaN                       \n2022-10-01                                                NaN                       \n2022-11-01                                                NaN                       \n2022-12-01                                                NaN                       \n\n            Current_Export__quantile__q_0.9  Current_Export__quantile__q_0.8  \\\nMonth                                                                          \n2022-08-01                              NaN                              NaN   \n2022-09-01                              NaN                              NaN   \n2022-10-01                              NaN                              NaN   \n2022-11-01                              NaN                              NaN   \n2022-12-01                              NaN                              NaN   \n\n            Current_Export__quantile__q_0.7  Current_Export__quantile__q_0.6  \\\nMonth                                                                          \n2022-08-01                              NaN                              NaN   \n2022-09-01                              NaN                              NaN   \n2022-10-01                              NaN                              NaN   \n2022-11-01                              NaN                              NaN   \n2022-12-01                              NaN                              NaN   \n\n            Current_Export__fft_coefficient__attr_\"real\"__coeff_0  ...  \\\nMonth                                                              ...   \n2022-08-01                                                NaN      ...   \n2022-09-01                                                NaN      ...   \n2022-10-01                                                NaN      ...   \n2022-11-01                                                NaN      ...   \n2022-12-01                                                NaN      ...   \n\n            Current_Export__quantile__q_0.2  Current_Export__quantile__q_0.1  \\\nMonth                                                                          \n2022-08-01                              NaN                              NaN   \n2022-09-01                              NaN                              NaN   \n2022-10-01                              NaN                              NaN   \n2022-11-01                              NaN                              NaN   \n2022-12-01                              NaN                              NaN   \n\n            Current_Export__minimum  Current_Export__maximum  \\\nMonth                                                          \n2022-08-01                      NaN                      NaN   \n2022-09-01                      NaN                      NaN   \n2022-10-01                      NaN                      NaN   \n2022-11-01                      NaN                      NaN   \n2022-12-01                      NaN                      NaN   \n\n            Current_Export__mean  Current_Export__median  \\\nMonth                                                      \n2022-08-01                   NaN                     NaN   \n2022-09-01                   NaN                     NaN   \n2022-10-01                   NaN                     NaN   \n2022-11-01                   NaN                     NaN   \n2022-12-01                   NaN                     NaN   \n\n            Current_Export__abs_energy  Current_Export__quantile__q_0.3  \\\nMonth                                                                     \n2022-08-01                         NaN                              NaN   \n2022-09-01                         NaN                              NaN   \n2022-10-01                         NaN                              NaN   \n2022-11-01                         NaN                              NaN   \n2022-12-01                         NaN                              NaN   \n\n            Current_Export__fft_coefficient__attr_\"abs\"__coeff_0  \\\nMonth                                                              \n2022-08-01                                                NaN      \n2022-09-01                                                NaN      \n2022-10-01                                                NaN      \n2022-11-01                                                NaN      \n2022-12-01                                                NaN      \n\n            Current_Export__benford_correlation  \nMonth                                            \n2022-08-01                                  NaN  \n2022-09-01                                  NaN  \n2022-10-01                                  NaN  \n2022-11-01                                  NaN  \n2022-12-01                                  NaN  \n\n[5 rows x 21 columns]","text/html":"<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Current_Export__sum_values</th>\n      <th>Current_Export__cwt_coefficients__coeff_0__w_20__widths_(2, 5, 10, 20)</th>\n      <th>Current_Export__cwt_coefficients__coeff_0__w_10__widths_(2, 5, 10, 20)</th>\n      <th>Current_Export__cwt_coefficients__coeff_0__w_5__widths_(2, 5, 10, 20)</th>\n      <th>Current_Export__cwt_coefficients__coeff_0__w_2__widths_(2, 5, 10, 20)</th>\n      <th>Current_Export__quantile__q_0.9</th>\n      <th>Current_Export__quantile__q_0.8</th>\n      <th>Current_Export__quantile__q_0.7</th>\n      <th>Current_Export__quantile__q_0.6</th>\n      <th>Current_Export__fft_coefficient__attr_\"real\"__coeff_0</th>\n      <th>...</th>\n      <th>Current_Export__quantile__q_0.2</th>\n      <th>Current_Export__quantile__q_0.1</th>\n      <th>Current_Export__minimum</th>\n      <th>Current_Export__maximum</th>\n      <th>Current_Export__mean</th>\n      <th>Current_Export__median</th>\n      <th>Current_Export__abs_energy</th>\n      <th>Current_Export__quantile__q_0.3</th>\n      <th>Current_Export__fft_coefficient__attr_\"abs\"__coeff_0</th>\n      <th>Current_Export__benford_correlation</th>\n    </tr>\n    <tr>\n      <th>Month</th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <td>2022-08-01</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>2022-09-01</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>2022-10-01</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>2022-11-01</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>2022-12-01</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n  </tbody>\n</table>\n<p>5 rows × 21 columns</p>\n</div>"},"execution_count":13}],"source":"data.tail()"},{"cell_type":"markdown","id":"adult-reliance","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"7780336F7D064872867260488ADDA58C","trusted":true,"mdEditEnable":false},"source":"填补之前空值"},{"cell_type":"code","execution_count":14,"id":"confused-reducing","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"150B8D4AF3FB42178576153FD63F3B09","trusted":true,"collapsed":false,"scrolled":false},"outputs":[],"source":"data=data.dropna()"},{"cell_type":"code","execution_count":15,"id":"equal-burlington","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"A79C5D0CE021430BB5213330A7562C8F","trusted":true,"collapsed":false,"scrolled":false},"outputs":[],"source":"data=data.reset_index()"},{"cell_type":"code","execution_count":16,"id":"existing-married","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"3787435233D6409FA94C1E2C1E464C21","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"execute_result","metadata":{},"data":{"text/plain":"       Month  Current_Export__sum_values  \\\n0 2009-01-01                      1096.0   \n1 2009-02-01                       873.7   \n2 2009-03-01                      1090.0   \n3 2009-04-01                      1187.0   \n4 2009-05-01                      1205.0   \n\n   Current_Export__cwt_coefficients__coeff_0__w_20__widths_(2, 5, 10, 20)  \\\n0                                         212.558001                        \n1                                         169.445187                        \n2                                         211.394362                        \n3                                         230.206521                        \n4                                         233.697437                        \n\n   Current_Export__cwt_coefficients__coeff_0__w_10__widths_(2, 5, 10, 20)  \\\n0                                         300.602407                        \n1                                         239.631682                        \n2                                         298.956774                        \n3                                         325.561184                        \n4                                         330.498085                        \n\n   Current_Export__cwt_coefficients__coeff_0__w_5__widths_(2, 5, 10, 20)  \\\n0                                         425.116001                       \n1                                         338.890374                       \n2                                         422.788724                       \n3                                         460.413042                       \n4                                         467.394874                       \n\n   Current_Export__cwt_coefficients__coeff_0__w_2__widths_(2, 5, 10, 20)  \\\n0                                         672.167417                       \n1                                         535.832730                       \n2                                         668.487668                       \n3                                         727.976938                       \n4                                         739.016184                       \n\n   Current_Export__quantile__q_0.9  Current_Export__quantile__q_0.8  \\\n0                           1096.0                           1096.0   \n1                            873.7                            873.7   \n2                           1090.0                           1090.0   \n3                           1187.0                           1187.0   \n4                           1205.0                           1205.0   \n\n   Current_Export__quantile__q_0.7  Current_Export__quantile__q_0.6  ...  \\\n0                           1096.0                           1096.0  ...   \n1                            873.7                            873.7  ...   \n2                           1090.0                           1090.0  ...   \n3                           1187.0                           1187.0  ...   \n4                           1205.0                           1205.0  ...   \n\n   Current_Export__quantile__q_0.2  Current_Export__quantile__q_0.1  \\\n0                           1096.0                           1096.0   \n1                            873.7                            873.7   \n2                           1090.0                           1090.0   \n3                           1187.0                           1187.0   \n4                           1205.0                           1205.0   \n\n   Current_Export__minimum  Current_Export__maximum  Current_Export__mean  \\\n0                   1096.0                   1096.0                1096.0   \n1                    873.7                    873.7                 873.7   \n2                   1090.0                   1090.0                1090.0   \n3                   1187.0                   1187.0                1187.0   \n4                   1205.0                   1205.0                1205.0   \n\n   Current_Export__median  Current_Export__abs_energy  \\\n0                  1096.0                  1201216.00   \n1                   873.7                   763351.69   \n2                  1090.0                  1188100.00   \n3                  1187.0                  1408969.00   \n4                  1205.0                  1452025.00   \n\n   Current_Export__quantile__q_0.3  \\\n0                           1096.0   \n1                            873.7   \n2                           1090.0   \n3                           1187.0   \n4                           1205.0   \n\n   Current_Export__fft_coefficient__attr_\"abs\"__coeff_0  \\\n0                                             1096.0      \n1                                              873.7      \n2                                             1090.0      \n3                                             1187.0      \n4                                             1205.0      \n\n   Current_Export__benford_correlation  \n0                             0.864123  \n1                            -0.272809  \n2                             0.864123  \n3                             0.864123  \n4                             0.864123  \n\n[5 rows x 22 columns]","text/html":"<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Month</th>\n      <th>Current_Export__sum_values</th>\n      <th>Current_Export__cwt_coefficients__coeff_0__w_20__widths_(2, 5, 10, 20)</th>\n      <th>Current_Export__cwt_coefficients__coeff_0__w_10__widths_(2, 5, 10, 20)</th>\n      <th>Current_Export__cwt_coefficients__coeff_0__w_5__widths_(2, 5, 10, 20)</th>\n      <th>Current_Export__cwt_coefficients__coeff_0__w_2__widths_(2, 5, 10, 20)</th>\n      <th>Current_Export__quantile__q_0.9</th>\n      <th>Current_Export__quantile__q_0.8</th>\n      <th>Current_Export__quantile__q_0.7</th>\n      <th>Current_Export__quantile__q_0.6</th>\n      <th>...</th>\n      <th>Current_Export__quantile__q_0.2</th>\n      <th>Current_Export__quantile__q_0.1</th>\n      <th>Current_Export__minimum</th>\n      <th>Current_Export__maximum</th>\n      <th>Current_Export__mean</th>\n      <th>Current_Export__median</th>\n      <th>Current_Export__abs_energy</th>\n      <th>Current_Export__quantile__q_0.3</th>\n      <th>Current_Export__fft_coefficient__attr_\"abs\"__coeff_0</th>\n      <th>Current_Export__benford_correlation</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <td>0</td>\n      <td>2009-01-01</td>\n      <td>1096.0</td>\n      <td>212.558001</td>\n      <td>300.602407</td>\n      <td>425.116001</td>\n      <td>672.167417</td>\n      <td>1096.0</td>\n      <td>1096.0</td>\n      <td>1096.0</td>\n      <td>1096.0</td>\n      <td>...</td>\n      <td>1096.0</td>\n      <td>1096.0</td>\n      <td>1096.0</td>\n      <td>1096.0</td>\n      <td>1096.0</td>\n      <td>1096.0</td>\n      <td>1201216.00</td>\n      <td>1096.0</td>\n      <td>1096.0</td>\n      <td>0.864123</td>\n    </tr>\n    <tr>\n      <td>1</td>\n      <td>2009-02-01</td>\n      <td>873.7</td>\n      <td>169.445187</td>\n      <td>239.631682</td>\n      <td>338.890374</td>\n      <td>535.832730</td>\n      <td>873.7</td>\n      <td>873.7</td>\n      <td>873.7</td>\n      <td>873.7</td>\n      <td>...</td>\n      <td>873.7</td>\n      <td>873.7</td>\n      <td>873.7</td>\n      <td>873.7</td>\n      <td>873.7</td>\n      <td>873.7</td>\n      <td>763351.69</td>\n      <td>873.7</td>\n      <td>873.7</td>\n      <td>-0.272809</td>\n    </tr>\n    <tr>\n      <td>2</td>\n      <td>2009-03-01</td>\n      <td>1090.0</td>\n      <td>211.394362</td>\n      <td>298.956774</td>\n      <td>422.788724</td>\n      <td>668.487668</td>\n      <td>1090.0</td>\n      <td>1090.0</td>\n      <td>1090.0</td>\n      <td>1090.0</td>\n      <td>...</td>\n      <td>1090.0</td>\n      <td>1090.0</td>\n      <td>1090.0</td>\n      <td>1090.0</td>\n      <td>1090.0</td>\n      <td>1090.0</td>\n      <td>1188100.00</td>\n      <td>1090.0</td>\n      <td>1090.0</td>\n      <td>0.864123</td>\n    </tr>\n    <tr>\n      <td>3</td>\n      <td>2009-04-01</td>\n      <td>1187.0</td>\n      <td>230.206521</td>\n      <td>325.561184</td>\n      <td>460.413042</td>\n      <td>727.976938</td>\n      <td>1187.0</td>\n      <td>1187.0</td>\n      <td>1187.0</td>\n      <td>1187.0</td>\n      <td>...</td>\n      <td>1187.0</td>\n      <td>1187.0</td>\n      <td>1187.0</td>\n      <td>1187.0</td>\n      <td>1187.0</td>\n      <td>1187.0</td>\n      <td>1408969.00</td>\n      <td>1187.0</td>\n      <td>1187.0</td>\n      <td>0.864123</td>\n    </tr>\n    <tr>\n      <td>4</td>\n      <td>2009-05-01</td>\n      <td>1205.0</td>\n      <td>233.697437</td>\n      <td>330.498085</td>\n      <td>467.394874</td>\n      <td>739.016184</td>\n      <td>1205.0</td>\n      <td>1205.0</td>\n      <td>1205.0</td>\n      <td>1205.0</td>\n      <td>...</td>\n      <td>1205.0</td>\n      <td>1205.0</td>\n      <td>1205.0</td>\n      <td>1205.0</td>\n      <td>1205.0</td>\n      <td>1205.0</td>\n      <td>1452025.00</td>\n      <td>1205.0</td>\n      <td>1205.0</td>\n      <td>0.864123</td>\n    </tr>\n  </tbody>\n</table>\n<p>5 rows × 22 columns</p>\n</div>"},"execution_count":16}],"source":"data.head()"},{"cell_type":"code","execution_count":17,"id":"parallel-cooling","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"D1AB9EDD102D4B9399F1FB5B1AF5EEE2","trusted":true,"collapsed":false,"scrolled":false},"outputs":[],"source":"# 连接标签与特征\ntarge_data=pd.DataFrame(dataset[[\"Current_Export\"]])"},{"cell_type":"code","execution_count":18,"id":"convinced-wagon","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"0F1A1FD23E8F40129AD9DA0DC0DB5EEA","trusted":true,"collapsed":false,"scrolled":false},"outputs":[],"source":"targe_data.reset_index(inplace=True)"},{"cell_type":"code","execution_count":19,"id":"sticky-character","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"DF72014F80F949848D4B1BCED484EC4B","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"stream","text":"<class 'pandas.core.frame.DataFrame'>\nRangeIndex: 180 entries, 0 to 179\nData columns (total 2 columns):\nMonth             180 non-null datetime64[ns]\nCurrent_Export    158 non-null float64\ndtypes: datetime64[ns](1), float64(1)\nmemory usage: 2.9 KB\n","name":"stdout"}],"source":"targe_data.info()"},{"cell_type":"code","execution_count":20,"id":"homeless-dispute","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"E472288E62CA4F2B9CD1B499EA4F2106","trusted":true,"collapsed":false,"scrolled":false},"outputs":[],"source":"# 连接特征表与标签表\nfull_data=pd.merge(data,targe_data,left_on=\"Month\",right_on=\"Month\")"},{"cell_type":"code","execution_count":21,"id":"political-california","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"E8D396AC618248E6ACFFC2CD2924F5FA","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"execute_result","metadata":{},"data":{"text/plain":"         Month  Current_Export__sum_values  \\\n0   2009-01-01                 1096.000000   \n1   2009-02-01                  873.700000   \n2   2009-03-01                 1090.000000   \n3   2009-04-01                 1187.000000   \n4   2009-05-01                 1205.000000   \n..         ...                         ...   \n153 2021-10-01                 2372.000000   \n154 2021-11-01                 2681.000000   \n155 2021-12-01                 2819.000000   \n156 2022-01-01                 1735.477922   \n157 2022-02-01                 1735.477922   \n\n     Current_Export__cwt_coefficients__coeff_0__w_20__widths_(2, 5, 10, 20)  \\\n0                                           212.558001                        \n1                                           169.445187                        \n2                                           211.394362                        \n3                                           230.206521                        \n4                                           233.697437                        \n..                                                 ...                        \n153                                         460.025162                        \n154                                         519.952555                        \n155                                         546.716244                        \n156                                         336.578209                        \n157                                         336.578209                        \n\n     Current_Export__cwt_coefficients__coeff_0__w_10__widths_(2, 5, 10, 20)  \\\n0                                           300.602407                        \n1                                           239.631682                        \n2                                           298.956774                        \n3                                           325.561184                        \n4                                           330.498085                        \n..                                                 ...                        \n153                                         650.573823                        \n154                                         735.323954                        \n155                                         773.173528                        \n156                                         475.993468                        \n157                                         475.993468                        \n\n     Current_Export__cwt_coefficients__coeff_0__w_5__widths_(2, 5, 10, 20)  \\\n0                                           425.116001                       \n1                                           338.890374                       \n2                                           422.788724                       \n3                                           460.413042                       \n4                                           467.394874                       \n..                                                 ...                       \n153                                         920.050324                       \n154                                        1039.905109                       \n155                                        1093.432489                       \n156                                         673.156419                       \n157                                         673.156419                       \n\n     Current_Export__cwt_coefficients__coeff_0__w_2__widths_(2, 5, 10, 20)  \\\n0                                           672.167417                       \n1                                           535.832730                       \n2                                           668.487668                       \n3                                           727.976938                       \n4                                           739.016184                       \n..                                                 ...                       \n153                                        1454.727293                       \n154                                        1644.234348                       \n155                                        1728.868566                       \n156                                        1064.353752                       \n157                                        1064.353752                       \n\n     Current_Export__quantile__q_0.9  Current_Export__quantile__q_0.8  \\\n0                        1096.000000                      1096.000000   \n1                         873.700000                       873.700000   \n2                        1090.000000                      1090.000000   \n3                        1187.000000                      1187.000000   \n4                        1205.000000                      1205.000000   \n..                               ...                              ...   \n153                      2372.000000                      2372.000000   \n154                      2681.000000                      2681.000000   \n155                      2819.000000                      2819.000000   \n156                      1735.477922                      1735.477922   \n157                      1735.477922                      1735.477922   \n\n     Current_Export__quantile__q_0.7  Current_Export__quantile__q_0.6  ...  \\\n0                        1096.000000                      1096.000000  ...   \n1                         873.700000                       873.700000  ...   \n2                        1090.000000                      1090.000000  ...   \n3                        1187.000000                      1187.000000  ...   \n4                        1205.000000                      1205.000000  ...   \n..                               ...                              ...  ...   \n153                      2372.000000                      2372.000000  ...   \n154                      2681.000000                      2681.000000  ...   \n155                      2819.000000                      2819.000000  ...   \n156                      1735.477922                      1735.477922  ...   \n157                      1735.477922                      1735.477922  ...   \n\n     Current_Export__quantile__q_0.1  Current_Export__minimum  \\\n0                        1096.000000              1096.000000   \n1                         873.700000               873.700000   \n2                        1090.000000              1090.000000   \n3                        1187.000000              1187.000000   \n4                        1205.000000              1205.000000   \n..                               ...                      ...   \n153                      2372.000000              2372.000000   \n154                      2681.000000              2681.000000   \n155                      2819.000000              2819.000000   \n156                      1735.477922              1735.477922   \n157                      1735.477922              1735.477922   \n\n     Current_Export__maximum  Current_Export__mean  Current_Export__median  \\\n0                1096.000000           1096.000000             1096.000000   \n1                 873.700000            873.700000              873.700000   \n2                1090.000000           1090.000000             1090.000000   \n3                1187.000000           1187.000000             1187.000000   \n4                1205.000000           1205.000000             1205.000000   \n..                       ...                   ...                     ...   \n153              2372.000000           2372.000000             2372.000000   \n154              2681.000000           2681.000000             2681.000000   \n155              2819.000000           2819.000000             2819.000000   \n156              1735.477922           1735.477922             1735.477922   \n157              1735.477922           1735.477922             1735.477922   \n\n     Current_Export__abs_energy  Current_Export__quantile__q_0.3  \\\n0                  1.201216e+06                      1096.000000   \n1                  7.633517e+05                       873.700000   \n2                  1.188100e+06                      1090.000000   \n3                  1.408969e+06                      1187.000000   \n4                  1.452025e+06                      1205.000000   \n..                          ...                              ...   \n153                5.626384e+06                      2372.000000   \n154                7.187761e+06                      2681.000000   \n155                7.946761e+06                      2819.000000   \n156                3.011884e+06                      1735.477922   \n157                3.011884e+06                      1735.477922   \n\n     Current_Export__fft_coefficient__attr_\"abs\"__coeff_0  \\\n0                                          1096.000000      \n1                                           873.700000      \n2                                          1090.000000      \n3                                          1187.000000      \n4                                          1205.000000      \n..                                                 ...      \n153                                        2372.000000      \n154                                        2681.000000      \n155                                        2819.000000      \n156                                        1735.477922      \n157                                        1735.477922      \n\n     Current_Export__benford_correlation  Current_Export  \n0                               0.864123           904.5  \n1                              -0.272809           648.9  \n2                               0.864123           902.9  \n3                               0.864123           919.3  \n4                               0.864123           887.6  \n..                                   ...             ...  \n153                             0.295657             NaN  \n154                             0.295657             NaN  \n155                             0.295657             NaN  \n156                             0.864123             NaN  \n157                             0.864123             NaN  \n\n[158 rows x 23 columns]","text/html":"<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Month</th>\n      <th>Current_Export__sum_values</th>\n      <th>Current_Export__cwt_coefficients__coeff_0__w_20__widths_(2, 5, 10, 20)</th>\n      <th>Current_Export__cwt_coefficients__coeff_0__w_10__widths_(2, 5, 10, 20)</th>\n      <th>Current_Export__cwt_coefficients__coeff_0__w_5__widths_(2, 5, 10, 20)</th>\n      <th>Current_Export__cwt_coefficients__coeff_0__w_2__widths_(2, 5, 10, 20)</th>\n      <th>Current_Export__quantile__q_0.9</th>\n      <th>Current_Export__quantile__q_0.8</th>\n      <th>Current_Export__quantile__q_0.7</th>\n      <th>Current_Export__quantile__q_0.6</th>\n      <th>...</th>\n      <th>Current_Export__quantile__q_0.1</th>\n      <th>Current_Export__minimum</th>\n      <th>Current_Export__maximum</th>\n      <th>Current_Export__mean</th>\n      <th>Current_Export__median</th>\n      <th>Current_Export__abs_energy</th>\n      <th>Current_Export__quantile__q_0.3</th>\n      <th>Current_Export__fft_coefficient__attr_\"abs\"__coeff_0</th>\n      <th>Current_Export__benford_correlation</th>\n      <th>Current_Export</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <td>0</td>\n      <td>2009-01-01</td>\n      <td>1096.000000</td>\n      <td>212.558001</td>\n      <td>300.602407</td>\n      <td>425.116001</td>\n      <td>672.167417</td>\n      <td>1096.000000</td>\n      <td>1096.000000</td>\n      <td>1096.000000</td>\n      <td>1096.000000</td>\n      <td>...</td>\n      <td>1096.000000</td>\n      <td>1096.000000</td>\n      <td>1096.000000</td>\n      <td>1096.000000</td>\n      <td>1096.000000</td>\n      <td>1.201216e+06</td>\n      <td>1096.000000</td>\n      <td>1096.000000</td>\n      <td>0.864123</td>\n      <td>904.5</td>\n    </tr>\n    <tr>\n      <td>1</td>\n      <td>2009-02-01</td>\n      <td>873.700000</td>\n      <td>169.445187</td>\n      <td>239.631682</td>\n      <td>338.890374</td>\n      <td>535.832730</td>\n      <td>873.700000</td>\n      <td>873.700000</td>\n      <td>873.700000</td>\n      <td>873.700000</td>\n      <td>...</td>\n      <td>873.700000</td>\n      <td>873.700000</td>\n      <td>873.700000</td>\n      <td>873.700000</td>\n      <td>873.700000</td>\n      <td>7.633517e+05</td>\n      <td>873.700000</td>\n      <td>873.700000</td>\n      <td>-0.272809</td>\n      <td>648.9</td>\n    </tr>\n    <tr>\n      <td>2</td>\n      <td>2009-03-01</td>\n      <td>1090.000000</td>\n      <td>211.394362</td>\n      <td>298.956774</td>\n      <td>422.788724</td>\n      <td>668.487668</td>\n      <td>1090.000000</td>\n      <td>1090.000000</td>\n      <td>1090.000000</td>\n      <td>1090.000000</td>\n      <td>...</td>\n      <td>1090.000000</td>\n      <td>1090.000000</td>\n      <td>1090.000000</td>\n      <td>1090.000000</td>\n      <td>1090.000000</td>\n      <td>1.188100e+06</td>\n      <td>1090.000000</td>\n      <td>1090.000000</td>\n      <td>0.864123</td>\n      <td>902.9</td>\n    </tr>\n    <tr>\n      <td>3</td>\n      <td>2009-04-01</td>\n      <td>1187.000000</td>\n      <td>230.206521</td>\n      <td>325.561184</td>\n      <td>460.413042</td>\n      <td>727.976938</td>\n      <td>1187.000000</td>\n      <td>1187.000000</td>\n      <td>1187.000000</td>\n      <td>1187.000000</td>\n      <td>...</td>\n      <td>1187.000000</td>\n      <td>1187.000000</td>\n      <td>1187.000000</td>\n      <td>1187.000000</td>\n      <td>1187.000000</td>\n      <td>1.408969e+06</td>\n      <td>1187.000000</td>\n      <td>1187.000000</td>\n      <td>0.864123</td>\n      <td>919.3</td>\n    </tr>\n    <tr>\n      <td>4</td>\n      <td>2009-05-01</td>\n      <td>1205.000000</td>\n      <td>233.697437</td>\n      <td>330.498085</td>\n      <td>467.394874</td>\n      <td>739.016184</td>\n      <td>1205.000000</td>\n      <td>1205.000000</td>\n      <td>1205.000000</td>\n      <td>1205.000000</td>\n      <td>...</td>\n      <td>1205.000000</td>\n      <td>1205.000000</td>\n      <td>1205.000000</td>\n      <td>1205.000000</td>\n      <td>1205.000000</td>\n      <td>1.452025e+06</td>\n      <td>1205.000000</td>\n      <td>1205.000000</td>\n      <td>0.864123</td>\n      <td>887.6</td>\n    </tr>\n    <tr>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <td>153</td>\n      <td>2021-10-01</td>\n      <td>2372.000000</td>\n      <td>460.025162</td>\n      <td>650.573823</td>\n      <td>920.050324</td>\n      <td>1454.727293</td>\n      <td>2372.000000</td>\n      <td>2372.000000</td>\n      <td>2372.000000</td>\n      <td>2372.000000</td>\n      <td>...</td>\n      <td>2372.000000</td>\n      <td>2372.000000</td>\n      <td>2372.000000</td>\n      <td>2372.000000</td>\n      <td>2372.000000</td>\n      <td>5.626384e+06</td>\n      <td>2372.000000</td>\n      <td>2372.000000</td>\n      <td>0.295657</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>154</td>\n      <td>2021-11-01</td>\n      <td>2681.000000</td>\n      <td>519.952555</td>\n      <td>735.323954</td>\n      <td>1039.905109</td>\n      <td>1644.234348</td>\n      <td>2681.000000</td>\n      <td>2681.000000</td>\n      <td>2681.000000</td>\n      <td>2681.000000</td>\n      <td>...</td>\n      <td>2681.000000</td>\n      <td>2681.000000</td>\n      <td>2681.000000</td>\n      <td>2681.000000</td>\n      <td>2681.000000</td>\n      <td>7.187761e+06</td>\n      <td>2681.000000</td>\n      <td>2681.000000</td>\n      <td>0.295657</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>155</td>\n      <td>2021-12-01</td>\n      <td>2819.000000</td>\n      <td>546.716244</td>\n      <td>773.173528</td>\n      <td>1093.432489</td>\n      <td>1728.868566</td>\n      <td>2819.000000</td>\n      <td>2819.000000</td>\n      <td>2819.000000</td>\n      <td>2819.000000</td>\n      <td>...</td>\n      <td>2819.000000</td>\n      <td>2819.000000</td>\n      <td>2819.000000</td>\n      <td>2819.000000</td>\n      <td>2819.000000</td>\n      <td>7.946761e+06</td>\n      <td>2819.000000</td>\n      <td>2819.000000</td>\n      <td>0.295657</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>156</td>\n      <td>2022-01-01</td>\n      <td>1735.477922</td>\n      <td>336.578209</td>\n      <td>475.993468</td>\n      <td>673.156419</td>\n      <td>1064.353752</td>\n      <td>1735.477922</td>\n      <td>1735.477922</td>\n      <td>1735.477922</td>\n      <td>1735.477922</td>\n      <td>...</td>\n      <td>1735.477922</td>\n      <td>1735.477922</td>\n      <td>1735.477922</td>\n      <td>1735.477922</td>\n      <td>1735.477922</td>\n      <td>3.011884e+06</td>\n      <td>1735.477922</td>\n      <td>1735.477922</td>\n      <td>0.864123</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>157</td>\n      <td>2022-02-01</td>\n      <td>1735.477922</td>\n      <td>336.578209</td>\n      <td>475.993468</td>\n      <td>673.156419</td>\n      <td>1064.353752</td>\n      <td>1735.477922</td>\n      <td>1735.477922</td>\n      <td>1735.477922</td>\n      <td>1735.477922</td>\n      <td>...</td>\n      <td>1735.477922</td>\n      <td>1735.477922</td>\n      <td>1735.477922</td>\n      <td>1735.477922</td>\n      <td>1735.477922</td>\n      <td>3.011884e+06</td>\n      <td>1735.477922</td>\n      <td>1735.477922</td>\n      <td>0.864123</td>\n      <td>NaN</td>\n    </tr>\n  </tbody>\n</table>\n<p>158 rows × 23 columns</p>\n</div>"},"execution_count":21}],"source":"full_data"},{"cell_type":"code","execution_count":22,"id":"considered-polls","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"D4AD3BD4A06E45E69F697C5FA268AA14","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"stream","text":"<class 'pandas.core.frame.DataFrame'>\nInt64Index: 158 entries, 0 to 157\nData columns (total 23 columns):\nMonth                                                                     158 non-null datetime64[ns]\nCurrent_Export__sum_values                                                158 non-null float64\nCurrent_Export__cwt_coefficients__coeff_0__w_20__widths_(2, 5, 10, 20)    158 non-null float64\nCurrent_Export__cwt_coefficients__coeff_0__w_10__widths_(2, 5, 10, 20)    158 non-null float64\nCurrent_Export__cwt_coefficients__coeff_0__w_5__widths_(2, 5, 10, 20)     158 non-null float64\nCurrent_Export__cwt_coefficients__coeff_0__w_2__widths_(2, 5, 10, 20)     158 non-null float64\nCurrent_Export__quantile__q_0.9                                           158 non-null float64\nCurrent_Export__quantile__q_0.8                                           158 non-null float64\nCurrent_Export__quantile__q_0.7                                           158 non-null float64\nCurrent_Export__quantile__q_0.6                                           158 non-null float64\nCurrent_Export__fft_coefficient__attr_\"real\"__coeff_0                     158 non-null float64\nCurrent_Export__quantile__q_0.4                                           158 non-null float64\nCurrent_Export__quantile__q_0.2                                           158 non-null float64\nCurrent_Export__quantile__q_0.1                                           158 non-null float64\nCurrent_Export__minimum                                                   158 non-null float64\nCurrent_Export__maximum                                                   158 non-null float64\nCurrent_Export__mean                                                      158 non-null float64\nCurrent_Export__median                                                    158 non-null float64\nCurrent_Export__abs_energy                                                158 non-null float64\nCurrent_Export__quantile__q_0.3                                           158 non-null float64\nCurrent_Export__fft_coefficient__attr_\"abs\"__coeff_0                      158 non-null float64\nCurrent_Export__benford_correlation                                       158 non-null float64\nCurrent_Export                                                            146 non-null float64\ndtypes: datetime64[ns](1), float64(22)\nmemory usage: 29.6 KB\n","name":"stdout"}],"source":"full_data.info()"},{"cell_type":"code","execution_count":23,"id":"hybrid-surgery","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"E329FB651E904AC781DE9CA837C2E787","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"execute_result","metadata":{},"data":{"text/plain":"       Month  Current_Export__sum_values  \\\n0 2009-01-01                      1096.0   \n1 2009-02-01                       873.7   \n2 2009-03-01                      1090.0   \n3 2009-04-01                      1187.0   \n4 2009-05-01                      1205.0   \n\n   Current_Export__cwt_coefficients__coeff_0__w_20__widths_(2, 5, 10, 20)  \\\n0                                         212.558001                        \n1                                         169.445187                        \n2                                         211.394362                        \n3                                         230.206521                        \n4                                         233.697437                        \n\n   Current_Export__cwt_coefficients__coeff_0__w_10__widths_(2, 5, 10, 20)  \\\n0                                         300.602407                        \n1                                         239.631682                        \n2                                         298.956774                        \n3                                         325.561184                        \n4                                         330.498085                        \n\n   Current_Export__cwt_coefficients__coeff_0__w_5__widths_(2, 5, 10, 20)  \\\n0                                         425.116001                       \n1                                         338.890374                       \n2                                         422.788724                       \n3                                         460.413042                       \n4                                         467.394874                       \n\n   Current_Export__cwt_coefficients__coeff_0__w_2__widths_(2, 5, 10, 20)  \\\n0                                         672.167417                       \n1                                         535.832730                       \n2                                         668.487668                       \n3                                         727.976938                       \n4                                         739.016184                       \n\n   Current_Export__quantile__q_0.9  Current_Export__quantile__q_0.8  \\\n0                           1096.0                           1096.0   \n1                            873.7                            873.7   \n2                           1090.0                           1090.0   \n3                           1187.0                           1187.0   \n4                           1205.0                           1205.0   \n\n   Current_Export__quantile__q_0.7  Current_Export__quantile__q_0.6  ...  \\\n0                           1096.0                           1096.0  ...   \n1                            873.7                            873.7  ...   \n2                           1090.0                           1090.0  ...   \n3                           1187.0                           1187.0  ...   \n4                           1205.0                           1205.0  ...   \n\n   Current_Export__quantile__q_0.1  Current_Export__minimum  \\\n0                           1096.0                   1096.0   \n1                            873.7                    873.7   \n2                           1090.0                   1090.0   \n3                           1187.0                   1187.0   \n4                           1205.0                   1205.0   \n\n   Current_Export__maximum  Current_Export__mean  Current_Export__median  \\\n0                   1096.0                1096.0                  1096.0   \n1                    873.7                 873.7                   873.7   \n2                   1090.0                1090.0                  1090.0   \n3                   1187.0                1187.0                  1187.0   \n4                   1205.0                1205.0                  1205.0   \n\n   Current_Export__abs_energy  Current_Export__quantile__q_0.3  \\\n0                  1201216.00                           1096.0   \n1                   763351.69                            873.7   \n2                  1188100.00                           1090.0   \n3                  1408969.00                           1187.0   \n4                  1452025.00                           1205.0   \n\n   Current_Export__fft_coefficient__attr_\"abs\"__coeff_0  \\\n0                                             1096.0      \n1                                              873.7      \n2                                             1090.0      \n3                                             1187.0      \n4                                             1205.0      \n\n   Current_Export__benford_correlation  Current_Export  \n0                             0.864123           904.5  \n1                            -0.272809           648.9  \n2                             0.864123           902.9  \n3                             0.864123           919.3  \n4                             0.864123           887.6  \n\n[5 rows x 23 columns]","text/html":"<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Month</th>\n      <th>Current_Export__sum_values</th>\n      <th>Current_Export__cwt_coefficients__coeff_0__w_20__widths_(2, 5, 10, 20)</th>\n      <th>Current_Export__cwt_coefficients__coeff_0__w_10__widths_(2, 5, 10, 20)</th>\n      <th>Current_Export__cwt_coefficients__coeff_0__w_5__widths_(2, 5, 10, 20)</th>\n      <th>Current_Export__cwt_coefficients__coeff_0__w_2__widths_(2, 5, 10, 20)</th>\n      <th>Current_Export__quantile__q_0.9</th>\n      <th>Current_Export__quantile__q_0.8</th>\n      <th>Current_Export__quantile__q_0.7</th>\n      <th>Current_Export__quantile__q_0.6</th>\n      <th>...</th>\n      <th>Current_Export__quantile__q_0.1</th>\n      <th>Current_Export__minimum</th>\n      <th>Current_Export__maximum</th>\n      <th>Current_Export__mean</th>\n      <th>Current_Export__median</th>\n      <th>Current_Export__abs_energy</th>\n      <th>Current_Export__quantile__q_0.3</th>\n      <th>Current_Export__fft_coefficient__attr_\"abs\"__coeff_0</th>\n      <th>Current_Export__benford_correlation</th>\n      <th>Current_Export</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <td>0</td>\n      <td>2009-01-01</td>\n      <td>1096.0</td>\n      <td>212.558001</td>\n      <td>300.602407</td>\n      <td>425.116001</td>\n      <td>672.167417</td>\n      <td>1096.0</td>\n      <td>1096.0</td>\n      <td>1096.0</td>\n      <td>1096.0</td>\n      <td>...</td>\n      <td>1096.0</td>\n      <td>1096.0</td>\n      <td>1096.0</td>\n      <td>1096.0</td>\n      <td>1096.0</td>\n      <td>1201216.00</td>\n      <td>1096.0</td>\n      <td>1096.0</td>\n      <td>0.864123</td>\n      <td>904.5</td>\n    </tr>\n    <tr>\n      <td>1</td>\n      <td>2009-02-01</td>\n      <td>873.7</td>\n      <td>169.445187</td>\n      <td>239.631682</td>\n      <td>338.890374</td>\n      <td>535.832730</td>\n      <td>873.7</td>\n      <td>873.7</td>\n      <td>873.7</td>\n      <td>873.7</td>\n      <td>...</td>\n      <td>873.7</td>\n      <td>873.7</td>\n      <td>873.7</td>\n      <td>873.7</td>\n      <td>873.7</td>\n      <td>763351.69</td>\n      <td>873.7</td>\n      <td>873.7</td>\n      <td>-0.272809</td>\n      <td>648.9</td>\n    </tr>\n    <tr>\n      <td>2</td>\n      <td>2009-03-01</td>\n      <td>1090.0</td>\n      <td>211.394362</td>\n      <td>298.956774</td>\n      <td>422.788724</td>\n      <td>668.487668</td>\n      <td>1090.0</td>\n      <td>1090.0</td>\n      <td>1090.0</td>\n      <td>1090.0</td>\n      <td>...</td>\n      <td>1090.0</td>\n      <td>1090.0</td>\n      <td>1090.0</td>\n      <td>1090.0</td>\n      <td>1090.0</td>\n      <td>1188100.00</td>\n      <td>1090.0</td>\n      <td>1090.0</td>\n      <td>0.864123</td>\n      <td>902.9</td>\n    </tr>\n    <tr>\n      <td>3</td>\n      <td>2009-04-01</td>\n      <td>1187.0</td>\n      <td>230.206521</td>\n      <td>325.561184</td>\n      <td>460.413042</td>\n      <td>727.976938</td>\n      <td>1187.0</td>\n      <td>1187.0</td>\n      <td>1187.0</td>\n      <td>1187.0</td>\n      <td>...</td>\n      <td>1187.0</td>\n      <td>1187.0</td>\n      <td>1187.0</td>\n      <td>1187.0</td>\n      <td>1187.0</td>\n      <td>1408969.00</td>\n      <td>1187.0</td>\n      <td>1187.0</td>\n      <td>0.864123</td>\n      <td>919.3</td>\n    </tr>\n    <tr>\n      <td>4</td>\n      <td>2009-05-01</td>\n      <td>1205.0</td>\n      <td>233.697437</td>\n      <td>330.498085</td>\n      <td>467.394874</td>\n      <td>739.016184</td>\n      <td>1205.0</td>\n      <td>1205.0</td>\n      <td>1205.0</td>\n      <td>1205.0</td>\n      <td>...</td>\n      <td>1205.0</td>\n      <td>1205.0</td>\n      <td>1205.0</td>\n      <td>1205.0</td>\n      <td>1205.0</td>\n      <td>1452025.00</td>\n      <td>1205.0</td>\n      <td>1205.0</td>\n      <td>0.864123</td>\n      <td>887.6</td>\n    </tr>\n  </tbody>\n</table>\n<p>5 rows × 23 columns</p>\n</div>"},"execution_count":23}],"source":"full_data.head()"},{"cell_type":"code","execution_count":24,"id":"adjustable-cleveland","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"0C4159AC0A5B4D4E8581546618D449A6","trusted":true,"collapsed":false,"scrolled":false},"outputs":[],"source":"# 单模型线性预测\nresult_lr = generate_result(full_data,feature=labels,target='Current_Export')"},{"cell_type":"code","execution_count":25,"id":"controversial-cowboy","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"80EAE96ABB57409C8F57C2F90D12EBA3","trusted":true,"collapsed":false,"scrolled":false},"outputs":[],"source":"# 切分数据集\ntrainset, testset = split_data(full_data)"},{"cell_type":"code","execution_count":26,"id":"spare-south","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"1FFF3A4340234C1BB1B5BFEC3B03F75F","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"execute_result","metadata":{},"data":{"text/plain":"array([2168.11760796, 1560.75903245, 2065.07409326, 2013.35570243,\n       2125.20337853, 2114.07514482, 2213.19334385, 2136.40035581,\n       2173.83811643, 2115.18487473, 2215.53310491])"},"execution_count":26}],"source":"result_lr"},{"cell_type":"code","execution_count":27,"id":"detected-selling","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"3410AEC3CAF8437882BFA2D273581EBA","trusted":true,"collapsed":false,"scrolled":false},"outputs":[],"source":"# 预测值与真实值间可视化\ndef visual(result_lr: Iterable, testset: pd.DataFrame,target:str = 'Current_Export')->None:\n    fig = plt.figure(figsize=(10,4))\n    plt.plot(testset['Month'], testset[target], label='real')\n    plt.plot(testset['Month'], result_lr, label='predicted')\n    plt.legend(loc='best')\n    plt.title(\"The \"+target+\" of real and predict \")\n    plt.xlabel(\"Time\")\n    plt.ylabel(\"Amount\")\n    plt.show()\n    fig = plt.figure(figsize=(10,4))\n#     sns.barplot(testset['Month'].dt.month)"},{"cell_type":"code","execution_count":28,"id":"distributed-lecture","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"0F6DDEE8592249B79BDCDEED4B8EF4DF","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"stream","text":"score: 61243.18855902367\n","name":"stdout"}],"source":"score_test(result_lr,testset[\"Current_Export\"])"},{"cell_type":"code","execution_count":29,"id":"existing-kentucky","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"A7BD8B8F84E24E8E8BDC91926EA313F9","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/A7BD8B8F84E24E8E8BDC91926EA313F9/qtww6kub8e.png\">"}},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}}],"source":"visual(result_lr,testset,\"Current_Export\")"},{"cell_type":"markdown","id":"constitutional-disability","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"8AE37F70A54E4E578C678F18A599D94C","trusted":true,"mdEditEnable":false},"source":"### 三 、多模型预测"},{"metadata":{"id":"4DCF0F3ADABF4C71854263B2163D3929","notebookId":"60b349d74223f3001719c3bd","jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"trusted":true,"mdEditEnable":false},"cell_type":"markdown","source":"根据以上的当单模型测试处理，我们使用多模型测试\n多模型思路：  \n* 导入数据集\n* 模型训练\n* 可视化\n* 评价结果"},{"cell_type":"markdown","id":"brilliant-compiler","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"49399D7B713146FE8390C97D1EAF9A28","trusted":true,"collapsed":false,"scrolled":false,"mdEditEnable":false},"source":"**出口量预测**\n"},{"metadata":{"id":"6AEFFE4FB7384384B1E03E649CE60DF6","notebookId":"60b349d74223f3001719c3bd","jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"trusted":true},"cell_type":"code","outputs":[],"source":"feature=[i for i in full_data.columns if i not in [\"Current_Export\",\"Month\"]]\ndef multi_model_eva(data, types:str = 'Current_Export'):\n    results = []\n    for model in [LinearRegression(), DecisionTreeRegressor(), RandomForestRegressor(), GradientBoostingRegressor(), MLPRegressor(solver='lbfgs'), xgb.XGBRegressor(objective='reg:squarederror')]:\n        if results is False:\n            results = generate_result(data,feature=feature, model=model,target=types)\n        else:\n            results.append(generate_result(data,feature=feature, model=model,target=types))\n    return results","execution_count":null},{"cell_type":"code","execution_count":31,"id":"casual-factor","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"4BE24BD3EA3D46B08F9385F2E7041699","trusted":true,"collapsed":false,"scrolled":false},"outputs":[],"source":"Current_Exporttol=multi_model_eva(full_data, 'Current_Export')"},{"cell_type":"code","execution_count":32,"id":"median-taste","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"6F19899F709C46C89E40A56687F6E0BE","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/6F19899F709C46C89E40A56687F6E0BE/qtww94zkor.png\">"}},{"output_type":"stream","text":"score: 61243.18855902367\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/6F19899F709C46C89E40A56687F6E0BE/qtww94d68i.png\">"}},{"output_type":"stream","text":"score: 4333.585858585865\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/6F19899F709C46C89E40A56687F6E0BE/qtww95cpsr.png\">"}},{"output_type":"stream","text":"score: 19507.996280407006\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/6F19899F709C46C89E40A56687F6E0BE/qtww95zpwn.png\">"}},{"output_type":"stream","text":"score: 11469.306513174022\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/6F19899F709C46C89E40A56687F6E0BE/qtww95npeh.png\">"}},{"output_type":"stream","text":"score: 66198.80924144525\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/6F19899F709C46C89E40A56687F6E0BE/qtww95b4wo.png\">"}},{"output_type":"stream","text":"score: 4502.298314879195\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}}],"source":"modle_name=[\"LinearRegression\",\"DecisionTreeRegressor\", \"RandomForestRegressor\", \"GradientBoostingRegressor\", \"MLPRegressor\",\"XGBRegressor\"]\nfor i in Current_Exporttol:\n    visual(i,testset)\n    score_test(i,testset[\"Current_Export\"])\n    "},{"cell_type":"markdown","id":"sharing-linux","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"EF4705BC358B4F5F9E7BBFC355CCCF44","trusted":true,"mdEditEnable":false},"source":"多模型测试，我们发现DecisionTreeRegressor对Current_Export预测效果最好"},{"cell_type":"code","execution_count":33,"id":"abroad-moisture","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"83548DED536F403884A10B760CAE20BB","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"execute_result","metadata":{},"data":{"text/plain":"[array([2168.11760796, 1560.75903245, 2065.07409326, 2013.35570243,\n        2125.20337853, 2114.07514482, 2213.19334385, 2136.40035581,\n        2173.83811643, 2115.18487473, 2215.53310491]),\n array([1735.47792208, 1735.47792208, 1851.        , 2003.        ,\n        2068.        , 2136.        , 2376.        , 2353.        ,\n        2398.        , 2153.66666667, 2681.        ]),\n array([2037.24337662, 1700.58675325, 2004.22      , 2026.8       ,\n        2067.96666667, 2153.08666667, 2439.3       , 2253.4       ,\n        2288.04779221, 2173.74666667, 2500.3       ]),\n array([1829.15020159, 1624.60439517, 1977.98841105, 2005.9647346 ,\n        2121.04901493, 2121.04901493, 2373.71465577, 2232.07418331,\n        2373.71465577, 2121.04901493, 2593.09146913]),\n array([2140.21033707, 1569.29374195, 2035.06980518, 2003.44273442,\n        2120.29955091, 2114.9567134 , 2159.99971561, 2125.59940637,\n        2142.78397163, 2115.49293134, 2160.99693288]),\n array([1744.0057, 1723.7112, 1865.7943, 2003.8767, 2068.0215, 2137.9902,\n        2377.424 , 2340.5732, 2394.1714, 2151.0476, 2671.0286],\n       dtype=float32)]"},"execution_count":33}],"source":"Current_Exporttol"},{"cell_type":"markdown","id":"elegant-monroe","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"A8FE236A5DC14D8781C40AD2D8D158F7","trusted":true,"mdEditEnable":false},"source":"### 四、各指标预测完成预测\n由于之前的单模型和多模型测试之后，效果良好  \n根据以上我们批量处理其他标签预测"},{"cell_type":"markdown","id":"experienced-royalty","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"36D5147BEA69486B803B47B6DC368515","trusted":true,"mdEditEnable":false},"source":"#### 1、Current_Import当月出口量预测"},{"cell_type":"code","execution_count":34,"id":"experienced-briefs","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"12F892AC9DE14EDA8E2D2675A9EAAE88","trusted":true,"collapsed":false,"scrolled":false},"outputs":[],"source":"file_labels=[\"Current_Export\",\"Current_Import\",\"M2\",\"M1\",\"M0\",\"FE_Reserve\",\"Gold_Reserve\",\"Fis_Current_Month_Value\",\"Nation_Current_Month\",\"City_Current_Month\",\"Country_Current_Month\"]\nfile_path=\"base_Current_Import.csv\"\ndataset=pd.read_csv(\"./特征工程/\"+file_path)"},{"cell_type":"code","execution_count":35,"id":"elementary-federal","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"E6162E1E1781489681CB5C046AA73456","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"execute_result","metadata":{},"data":{"text/plain":"     Current_Import__sum_values  \\\n0                         901.7   \n1                         788.1   \n2                         955.6   \n3                        1020.0   \n4                        1003.0   \n..                          ...   \n175                         NaN   \n176                         NaN   \n177                         NaN   \n178                         NaN   \n179                         NaN   \n\n     Current_Import__cwt_coefficients__coeff_0__w_20__widths_(2, 5, 10, 20)  \\\n0                                           174.875501                        \n1                                           152.843942                        \n2                                           185.328855                        \n3                                           197.818577                        \n4                                           194.521601                        \n..                                                 ...                        \n175                                                NaN                        \n176                                                NaN                        \n177                                                NaN                        \n178                                                NaN                        \n179                                                NaN                        \n\n     Current_Import__cwt_coefficients__coeff_0__w_10__widths_(2, 5, 10, 20)  \\\n0                                           247.311305                        \n1                                           216.153976                        \n2                                           262.094581                        \n3                                           279.757715                        \n4                                           275.095086                        \n..                                                 ...                        \n175                                                NaN                        \n176                                                NaN                        \n177                                                NaN                        \n178                                                NaN                        \n179                                                NaN                        \n\n     Current_Import__cwt_coefficients__coeff_0__w_5__widths_(2, 5, 10, 20)  \\\n0                                           349.751002                       \n1                                           305.687884                       \n2                                           370.657711                       \n3                                           395.637155                       \n4                                           389.043202                       \n..                                                 ...                       \n175                                                NaN                       \n176                                                NaN                       \n177                                                NaN                       \n178                                                NaN                       \n179                                                NaN                       \n\n     Current_Import__cwt_coefficients__coeff_0__w_2__widths_(2, 5, 10, 20)  \\\n0                                           553.004890                       \n1                                           483.334983                       \n2                                           586.061299                       \n3                                           625.557268                       \n4                                           615.131313                       \n..                                                 ...                       \n175                                                NaN                       \n176                                                NaN                       \n177                                                NaN                       \n178                                                NaN                       \n179                                                NaN                       \n\n     Current_Import__quantile__q_0.9  Current_Import__quantile__q_0.8  \\\n0                              901.7                            901.7   \n1                              788.1                            788.1   \n2                              955.6                            955.6   \n3                             1020.0                           1020.0   \n4                             1003.0                           1003.0   \n..                               ...                              ...   \n175                              NaN                              NaN   \n176                              NaN                              NaN   \n177                              NaN                              NaN   \n178                              NaN                              NaN   \n179                              NaN                              NaN   \n\n     Current_Import__quantile__q_0.7  Current_Import__quantile__q_0.6  \\\n0                              901.7                            901.7   \n1                              788.1                            788.1   \n2                              955.6                            955.6   \n3                             1020.0                           1020.0   \n4                             1003.0                           1003.0   \n..                               ...                              ...   \n175                              NaN                              NaN   \n176                              NaN                              NaN   \n177                              NaN                              NaN   \n178                              NaN                              NaN   \n179                              NaN                              NaN   \n\n     Current_Import__fft_coefficient__attr_\"real\"__coeff_0  ...  \\\n0                                                901.7      ...   \n1                                                788.1      ...   \n2                                                955.6      ...   \n3                                               1020.0      ...   \n4                                               1003.0      ...   \n..                                                 ...      ...   \n175                                                NaN      ...   \n176                                                NaN      ...   \n177                                                NaN      ...   \n178                                                NaN      ...   \n179                                                NaN      ...   \n\n     Current_Import__minimum  Current_Import__maximum  Current_Import__mean  \\\n0                      901.7                    901.7                 901.7   \n1                      788.1                    788.1                 788.1   \n2                      955.6                    955.6                 955.6   \n3                     1020.0                   1020.0                1020.0   \n4                     1003.0                   1003.0                1003.0   \n..                       ...                      ...                   ...   \n175                      NaN                      NaN                   NaN   \n176                      NaN                      NaN                   NaN   \n177                      NaN                      NaN                   NaN   \n178                      NaN                      NaN                   NaN   \n179                      NaN                      NaN                   NaN   \n\n     Current_Import__median  Current_Import__abs_energy  \\\n0                     901.7                   813062.89   \n1                     788.1                   621101.61   \n2                     955.6                   913171.36   \n3                    1020.0                  1040400.00   \n4                    1003.0                  1006009.00   \n..                      ...                         ...   \n175                     NaN                         NaN   \n176                     NaN                         NaN   \n177                     NaN                         NaN   \n178                     NaN                         NaN   \n179                     NaN                         NaN   \n\n     Current_Import__quantile__q_0.3  \\\n0                              901.7   \n1                              788.1   \n2                              955.6   \n3                             1020.0   \n4                             1003.0   \n..                               ...   \n175                              NaN   \n176                              NaN   \n177                              NaN   \n178                              NaN   \n179                              NaN   \n\n     Current_Import__fft_coefficient__attr_\"abs\"__coeff_0  \\\n0                                                901.7      \n1                                                788.1      \n2                                                955.6      \n3                                               1020.0      \n4                                               1003.0      \n..                                                 ...      \n175                                                NaN      \n176                                                NaN      \n177                                                NaN      \n178                                                NaN      \n179                                                NaN      \n\n     Current_Import__benford_correlation       Month  Current_Import  \n0                              -0.297356  2008-01-01           901.7  \n1                              -0.241690  2008-02-01           788.1  \n2                              -0.297356  2008-03-01           955.6  \n3                               0.864123  2008-04-01          1020.0  \n4                               0.864123  2008-05-01          1003.0  \n..                                   ...         ...             ...  \n175                                  NaN  2022-08-01             NaN  \n176                                  NaN  2022-09-01             NaN  \n177                                  NaN  2022-10-01             NaN  \n178                                  NaN  2022-11-01             NaN  \n179                                  NaN  2022-12-01             NaN  \n\n[180 rows x 23 columns]","text/html":"<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Current_Import__sum_values</th>\n      <th>Current_Import__cwt_coefficients__coeff_0__w_20__widths_(2, 5, 10, 20)</th>\n      <th>Current_Import__cwt_coefficients__coeff_0__w_10__widths_(2, 5, 10, 20)</th>\n      <th>Current_Import__cwt_coefficients__coeff_0__w_5__widths_(2, 5, 10, 20)</th>\n      <th>Current_Import__cwt_coefficients__coeff_0__w_2__widths_(2, 5, 10, 20)</th>\n      <th>Current_Import__quantile__q_0.9</th>\n      <th>Current_Import__quantile__q_0.8</th>\n      <th>Current_Import__quantile__q_0.7</th>\n      <th>Current_Import__quantile__q_0.6</th>\n      <th>Current_Import__fft_coefficient__attr_\"real\"__coeff_0</th>\n      <th>...</th>\n      <th>Current_Import__minimum</th>\n      <th>Current_Import__maximum</th>\n      <th>Current_Import__mean</th>\n      <th>Current_Import__median</th>\n      <th>Current_Import__abs_energy</th>\n      <th>Current_Import__quantile__q_0.3</th>\n      <th>Current_Import__fft_coefficient__attr_\"abs\"__coeff_0</th>\n      <th>Current_Import__benford_correlation</th>\n      <th>Month</th>\n      <th>Current_Import</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <td>0</td>\n      <td>901.7</td>\n      <td>174.875501</td>\n      <td>247.311305</td>\n      <td>349.751002</td>\n      <td>553.004890</td>\n      <td>901.7</td>\n      <td>901.7</td>\n      <td>901.7</td>\n      <td>901.7</td>\n      <td>901.7</td>\n      <td>...</td>\n      <td>901.7</td>\n      <td>901.7</td>\n      <td>901.7</td>\n      <td>901.7</td>\n      <td>813062.89</td>\n      <td>901.7</td>\n      <td>901.7</td>\n      <td>-0.297356</td>\n      <td>2008-01-01</td>\n      <td>901.7</td>\n    </tr>\n    <tr>\n      <td>1</td>\n      <td>788.1</td>\n      <td>152.843942</td>\n      <td>216.153976</td>\n      <td>305.687884</td>\n      <td>483.334983</td>\n      <td>788.1</td>\n      <td>788.1</td>\n      <td>788.1</td>\n      <td>788.1</td>\n      <td>788.1</td>\n      <td>...</td>\n      <td>788.1</td>\n      <td>788.1</td>\n      <td>788.1</td>\n      <td>788.1</td>\n      <td>621101.61</td>\n      <td>788.1</td>\n      <td>788.1</td>\n      <td>-0.241690</td>\n      <td>2008-02-01</td>\n      <td>788.1</td>\n    </tr>\n    <tr>\n      <td>2</td>\n      <td>955.6</td>\n      <td>185.328855</td>\n      <td>262.094581</td>\n      <td>370.657711</td>\n      <td>586.061299</td>\n      <td>955.6</td>\n      <td>955.6</td>\n      <td>955.6</td>\n      <td>955.6</td>\n      <td>955.6</td>\n      <td>...</td>\n      <td>955.6</td>\n      <td>955.6</td>\n      <td>955.6</td>\n      <td>955.6</td>\n      <td>913171.36</td>\n      <td>955.6</td>\n      <td>955.6</td>\n      <td>-0.297356</td>\n      <td>2008-03-01</td>\n      <td>955.6</td>\n    </tr>\n    <tr>\n      <td>3</td>\n      <td>1020.0</td>\n      <td>197.818577</td>\n      <td>279.757715</td>\n      <td>395.637155</td>\n      <td>625.557268</td>\n      <td>1020.0</td>\n      <td>1020.0</td>\n      <td>1020.0</td>\n      <td>1020.0</td>\n      <td>1020.0</td>\n      <td>...</td>\n      <td>1020.0</td>\n      <td>1020.0</td>\n      <td>1020.0</td>\n      <td>1020.0</td>\n      <td>1040400.00</td>\n      <td>1020.0</td>\n      <td>1020.0</td>\n      <td>0.864123</td>\n      <td>2008-04-01</td>\n      <td>1020.0</td>\n    </tr>\n    <tr>\n      <td>4</td>\n      <td>1003.0</td>\n      <td>194.521601</td>\n      <td>275.095086</td>\n      <td>389.043202</td>\n      <td>615.131313</td>\n      <td>1003.0</td>\n      <td>1003.0</td>\n      <td>1003.0</td>\n      <td>1003.0</td>\n      <td>1003.0</td>\n      <td>...</td>\n      <td>1003.0</td>\n      <td>1003.0</td>\n      <td>1003.0</td>\n      <td>1003.0</td>\n      <td>1006009.00</td>\n      <td>1003.0</td>\n      <td>1003.0</td>\n      <td>0.864123</td>\n      <td>2008-05-01</td>\n      <td>1003.0</td>\n    </tr>\n    <tr>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <td>175</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>2022-08-01</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>176</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>2022-09-01</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>177</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>2022-10-01</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>178</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>2022-11-01</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>179</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>2022-12-01</td>\n      <td>NaN</td>\n    </tr>\n  </tbody>\n</table>\n<p>180 rows × 23 columns</p>\n</div>"},"execution_count":35}],"source":"dataset"},{"cell_type":"code","execution_count":36,"id":"incident-example","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"34D7A9D533394C24BAC885F83178D162","trusted":true,"collapsed":false,"scrolled":false},"outputs":[],"source":"dataset[\"Month\"]=pd.to_datetime(dataset[\"Month\"])\ndataset=dataset.set_index(\"Month\")\nfeature=[ i for i in dataset.columns  if i not in [\"Month\",\"Current_Import\"]]\ndata=dataset[feature].shift(12)\ndata=data.dropna()\ntarge_data=pd.DataFrame(dataset[[\"Current_Import\"]])"},{"cell_type":"code","execution_count":37,"id":"arranged-romance","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"EB69726AB3504F38887BE9FBB253773F","trusted":true,"collapsed":false,"scrolled":false},"outputs":[],"source":"targe_data.reset_index(inplace=True)\nfull_data=pd.merge(data,targe_data,on=\"Month\")"},{"cell_type":"code","execution_count":38,"id":"endless-cooperation","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"F98743C76FF748638CD61DD33750F197","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"execute_result","metadata":{},"data":{"text/plain":"         Month  Current_Import__sum_values  \\\n0   2009-01-01                  901.700000   \n1   2009-02-01                  788.100000   \n2   2009-03-01                  955.600000   \n3   2009-04-01                 1020.000000   \n4   2009-05-01                 1003.000000   \n..         ...                         ...   \n153 2021-10-01                 1787.000000   \n154 2021-11-01                 1926.000000   \n155 2021-12-01                 2038.000000   \n156 2022-01-01                 1433.764286   \n157 2022-02-01                 1433.764286   \n\n     Current_Import__cwt_coefficients__coeff_0__w_20__widths_(2, 5, 10, 20)  \\\n0                                           174.875501                        \n1                                           152.843942                        \n2                                           185.328855                        \n3                                           197.818577                        \n4                                           194.521601                        \n..                                                 ...                        \n153                                         346.570390                        \n154                                         373.528019                        \n155                                         395.249275                        \n156                                         278.063932                        \n157                                         278.063932                        \n\n     Current_Import__cwt_coefficients__coeff_0__w_10__widths_(2, 5, 10, 20)  \\\n0                                           247.311305                        \n1                                           216.153976                        \n2                                           262.094581                        \n3                                           279.757715                        \n4                                           275.095086                        \n..                                                 ...                        \n153                                         490.124546                        \n154                                         528.248391                        \n155                                         558.966885                        \n156                                         393.241785                        \n157                                         393.241785                        \n\n     Current_Import__cwt_coefficients__coeff_0__w_5__widths_(2, 5, 10, 20)  \\\n0                                           349.751002                       \n1                                           305.687884                       \n2                                           370.657711                       \n3                                           395.637155                       \n4                                           389.043202                       \n..                                                 ...                       \n153                                         693.140780                       \n154                                         747.056039                       \n155                                         790.498550                       \n156                                         556.127865                       \n157                                         556.127865                       \n\n     Current_Import__cwt_coefficients__coeff_0__w_2__widths_(2, 5, 10, 20)  \\\n0                                           553.004890                       \n1                                           483.334983                       \n2                                           586.061299                       \n3                                           625.557268                       \n4                                           615.131313                       \n..                                                 ...                       \n153                                        1095.951801                       \n154                                        1181.199311                       \n155                                        1249.887952                       \n156                                         879.315362                       \n157                                         879.315362                       \n\n     Current_Import__quantile__q_0.9  Current_Import__quantile__q_0.8  \\\n0                         901.700000                       901.700000   \n1                         788.100000                       788.100000   \n2                         955.600000                       955.600000   \n3                        1020.000000                      1020.000000   \n4                        1003.000000                      1003.000000   \n..                               ...                              ...   \n153                      1787.000000                      1787.000000   \n154                      1926.000000                      1926.000000   \n155                      2038.000000                      2038.000000   \n156                      1433.764286                      1433.764286   \n157                      1433.764286                      1433.764286   \n\n     Current_Import__quantile__q_0.7  Current_Import__quantile__q_0.6  ...  \\\n0                         901.700000                       901.700000  ...   \n1                         788.100000                       788.100000  ...   \n2                         955.600000                       955.600000  ...   \n3                        1020.000000                      1020.000000  ...   \n4                        1003.000000                      1003.000000  ...   \n..                               ...                              ...  ...   \n153                      1787.000000                      1787.000000  ...   \n154                      1926.000000                      1926.000000  ...   \n155                      2038.000000                      2038.000000  ...   \n156                      1433.764286                      1433.764286  ...   \n157                      1433.764286                      1433.764286  ...   \n\n     Current_Import__quantile__q_0.1  Current_Import__minimum  \\\n0                         901.700000               901.700000   \n1                         788.100000               788.100000   \n2                         955.600000               955.600000   \n3                        1020.000000              1020.000000   \n4                        1003.000000              1003.000000   \n..                               ...                      ...   \n153                      1787.000000              1787.000000   \n154                      1926.000000              1926.000000   \n155                      2038.000000              2038.000000   \n156                      1433.764286              1433.764286   \n157                      1433.764286              1433.764286   \n\n     Current_Import__maximum  Current_Import__mean  Current_Import__median  \\\n0                 901.700000            901.700000              901.700000   \n1                 788.100000            788.100000              788.100000   \n2                 955.600000            955.600000              955.600000   \n3                1020.000000           1020.000000             1020.000000   \n4                1003.000000           1003.000000             1003.000000   \n..                       ...                   ...                     ...   \n153              1787.000000           1787.000000             1787.000000   \n154              1926.000000           1926.000000             1926.000000   \n155              2038.000000           2038.000000             2038.000000   \n156              1433.764286           1433.764286             1433.764286   \n157              1433.764286           1433.764286             1433.764286   \n\n     Current_Import__abs_energy  Current_Import__quantile__q_0.3  \\\n0                  8.130629e+05                       901.700000   \n1                  6.211016e+05                       788.100000   \n2                  9.131714e+05                       955.600000   \n3                  1.040400e+06                      1020.000000   \n4                  1.006009e+06                      1003.000000   \n..                          ...                              ...   \n153                3.193369e+06                      1787.000000   \n154                3.709476e+06                      1926.000000   \n155                4.153444e+06                      2038.000000   \n156                2.055680e+06                      1433.764286   \n157                2.055680e+06                      1433.764286   \n\n     Current_Import__fft_coefficient__attr_\"abs\"__coeff_0  \\\n0                                           901.700000      \n1                                           788.100000      \n2                                           955.600000      \n3                                          1020.000000      \n4                                          1003.000000      \n..                                                 ...      \n153                                        1787.000000      \n154                                        1926.000000      \n155                                        2038.000000      \n156                                        1433.764286      \n157                                        1433.764286      \n\n     Current_Import__benford_correlation  Current_Import  \n0                              -0.297356           513.4  \n1                              -0.241690           600.5  \n2                              -0.297356           717.3  \n3                               0.864123           788.0  \n4                               0.864123           753.7  \n..                                   ...             ...  \n153                             0.864123             NaN  \n154                             0.864123             NaN  \n155                             0.295657             NaN  \n156                             0.864123             NaN  \n157                             0.864123             NaN  \n\n[158 rows x 23 columns]","text/html":"<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Month</th>\n      <th>Current_Import__sum_values</th>\n      <th>Current_Import__cwt_coefficients__coeff_0__w_20__widths_(2, 5, 10, 20)</th>\n      <th>Current_Import__cwt_coefficients__coeff_0__w_10__widths_(2, 5, 10, 20)</th>\n      <th>Current_Import__cwt_coefficients__coeff_0__w_5__widths_(2, 5, 10, 20)</th>\n      <th>Current_Import__cwt_coefficients__coeff_0__w_2__widths_(2, 5, 10, 20)</th>\n      <th>Current_Import__quantile__q_0.9</th>\n      <th>Current_Import__quantile__q_0.8</th>\n      <th>Current_Import__quantile__q_0.7</th>\n      <th>Current_Import__quantile__q_0.6</th>\n      <th>...</th>\n      <th>Current_Import__quantile__q_0.1</th>\n      <th>Current_Import__minimum</th>\n      <th>Current_Import__maximum</th>\n      <th>Current_Import__mean</th>\n      <th>Current_Import__median</th>\n      <th>Current_Import__abs_energy</th>\n      <th>Current_Import__quantile__q_0.3</th>\n      <th>Current_Import__fft_coefficient__attr_\"abs\"__coeff_0</th>\n      <th>Current_Import__benford_correlation</th>\n      <th>Current_Import</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <td>0</td>\n      <td>2009-01-01</td>\n      <td>901.700000</td>\n      <td>174.875501</td>\n      <td>247.311305</td>\n      <td>349.751002</td>\n      <td>553.004890</td>\n      <td>901.700000</td>\n      <td>901.700000</td>\n      <td>901.700000</td>\n      <td>901.700000</td>\n      <td>...</td>\n      <td>901.700000</td>\n      <td>901.700000</td>\n      <td>901.700000</td>\n      <td>901.700000</td>\n      <td>901.700000</td>\n      <td>8.130629e+05</td>\n      <td>901.700000</td>\n      <td>901.700000</td>\n      <td>-0.297356</td>\n      <td>513.4</td>\n    </tr>\n    <tr>\n      <td>1</td>\n      <td>2009-02-01</td>\n      <td>788.100000</td>\n      <td>152.843942</td>\n      <td>216.153976</td>\n      <td>305.687884</td>\n      <td>483.334983</td>\n      <td>788.100000</td>\n      <td>788.100000</td>\n      <td>788.100000</td>\n      <td>788.100000</td>\n      <td>...</td>\n      <td>788.100000</td>\n      <td>788.100000</td>\n      <td>788.100000</td>\n      <td>788.100000</td>\n      <td>788.100000</td>\n      <td>6.211016e+05</td>\n      <td>788.100000</td>\n      <td>788.100000</td>\n      <td>-0.241690</td>\n      <td>600.5</td>\n    </tr>\n    <tr>\n      <td>2</td>\n      <td>2009-03-01</td>\n      <td>955.600000</td>\n      <td>185.328855</td>\n      <td>262.094581</td>\n      <td>370.657711</td>\n      <td>586.061299</td>\n      <td>955.600000</td>\n      <td>955.600000</td>\n      <td>955.600000</td>\n      <td>955.600000</td>\n      <td>...</td>\n      <td>955.600000</td>\n      <td>955.600000</td>\n      <td>955.600000</td>\n      <td>955.600000</td>\n      <td>955.600000</td>\n      <td>9.131714e+05</td>\n      <td>955.600000</td>\n      <td>955.600000</td>\n      <td>-0.297356</td>\n      <td>717.3</td>\n    </tr>\n    <tr>\n      <td>3</td>\n      <td>2009-04-01</td>\n      <td>1020.000000</td>\n      <td>197.818577</td>\n      <td>279.757715</td>\n      <td>395.637155</td>\n      <td>625.557268</td>\n      <td>1020.000000</td>\n      <td>1020.000000</td>\n      <td>1020.000000</td>\n      <td>1020.000000</td>\n      <td>...</td>\n      <td>1020.000000</td>\n      <td>1020.000000</td>\n      <td>1020.000000</td>\n      <td>1020.000000</td>\n      <td>1020.000000</td>\n      <td>1.040400e+06</td>\n      <td>1020.000000</td>\n      <td>1020.000000</td>\n      <td>0.864123</td>\n      <td>788.0</td>\n    </tr>\n    <tr>\n      <td>4</td>\n      <td>2009-05-01</td>\n      <td>1003.000000</td>\n      <td>194.521601</td>\n      <td>275.095086</td>\n      <td>389.043202</td>\n      <td>615.131313</td>\n      <td>1003.000000</td>\n      <td>1003.000000</td>\n      <td>1003.000000</td>\n      <td>1003.000000</td>\n      <td>...</td>\n      <td>1003.000000</td>\n      <td>1003.000000</td>\n      <td>1003.000000</td>\n      <td>1003.000000</td>\n      <td>1003.000000</td>\n      <td>1.006009e+06</td>\n      <td>1003.000000</td>\n      <td>1003.000000</td>\n      <td>0.864123</td>\n      <td>753.7</td>\n    </tr>\n    <tr>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <td>153</td>\n      <td>2021-10-01</td>\n      <td>1787.000000</td>\n      <td>346.570390</td>\n      <td>490.124546</td>\n      <td>693.140780</td>\n      <td>1095.951801</td>\n      <td>1787.000000</td>\n      <td>1787.000000</td>\n      <td>1787.000000</td>\n      <td>1787.000000</td>\n      <td>...</td>\n      <td>1787.000000</td>\n      <td>1787.000000</td>\n      <td>1787.000000</td>\n      <td>1787.000000</td>\n      <td>1787.000000</td>\n      <td>3.193369e+06</td>\n      <td>1787.000000</td>\n      <td>1787.000000</td>\n      <td>0.864123</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>154</td>\n      <td>2021-11-01</td>\n      <td>1926.000000</td>\n      <td>373.528019</td>\n      <td>528.248391</td>\n      <td>747.056039</td>\n      <td>1181.199311</td>\n      <td>1926.000000</td>\n      <td>1926.000000</td>\n      <td>1926.000000</td>\n      <td>1926.000000</td>\n      <td>...</td>\n      <td>1926.000000</td>\n      <td>1926.000000</td>\n      <td>1926.000000</td>\n      <td>1926.000000</td>\n      <td>1926.000000</td>\n      <td>3.709476e+06</td>\n      <td>1926.000000</td>\n      <td>1926.000000</td>\n      <td>0.864123</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>155</td>\n      <td>2021-12-01</td>\n      <td>2038.000000</td>\n      <td>395.249275</td>\n      <td>558.966885</td>\n      <td>790.498550</td>\n      <td>1249.887952</td>\n      <td>2038.000000</td>\n      <td>2038.000000</td>\n      <td>2038.000000</td>\n      <td>2038.000000</td>\n      <td>...</td>\n      <td>2038.000000</td>\n      <td>2038.000000</td>\n      <td>2038.000000</td>\n      <td>2038.000000</td>\n      <td>2038.000000</td>\n      <td>4.153444e+06</td>\n      <td>2038.000000</td>\n      <td>2038.000000</td>\n      <td>0.295657</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>156</td>\n      <td>2022-01-01</td>\n      <td>1433.764286</td>\n      <td>278.063932</td>\n      <td>393.241785</td>\n      <td>556.127865</td>\n      <td>879.315362</td>\n      <td>1433.764286</td>\n      <td>1433.764286</td>\n      <td>1433.764286</td>\n      <td>1433.764286</td>\n      <td>...</td>\n      <td>1433.764286</td>\n      <td>1433.764286</td>\n      <td>1433.764286</td>\n      <td>1433.764286</td>\n      <td>1433.764286</td>\n      <td>2.055680e+06</td>\n      <td>1433.764286</td>\n      <td>1433.764286</td>\n      <td>0.864123</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>157</td>\n      <td>2022-02-01</td>\n      <td>1433.764286</td>\n      <td>278.063932</td>\n      <td>393.241785</td>\n      <td>556.127865</td>\n      <td>879.315362</td>\n      <td>1433.764286</td>\n      <td>1433.764286</td>\n      <td>1433.764286</td>\n      <td>1433.764286</td>\n      <td>...</td>\n      <td>1433.764286</td>\n      <td>1433.764286</td>\n      <td>1433.764286</td>\n      <td>1433.764286</td>\n      <td>1433.764286</td>\n      <td>2.055680e+06</td>\n      <td>1433.764286</td>\n      <td>1433.764286</td>\n      <td>0.864123</td>\n      <td>NaN</td>\n    </tr>\n  </tbody>\n</table>\n<p>158 rows × 23 columns</p>\n</div>"},"execution_count":38}],"source":"full_data"},{"cell_type":"code","execution_count":39,"id":"prime-worcester","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"DCA17C15990C44EC8D487CB1F86C00D7","trusted":true,"collapsed":false,"scrolled":false},"outputs":[],"source":"Current_Import_result_lr = generate_result(full_data,feature=feature,target=\"Current_Import\")\ntrainset, testset = split_data(full_data)"},{"cell_type":"code","execution_count":40,"id":"modern-gender","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"AFE09D95E8804E6A8375E6175BDEC22B","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"execute_result","metadata":{},"data":{"text/plain":"array([1702.10741327, 1463.27255817, 1644.99261935, 1707.86901607,\n       1674.03831547, 1625.24853848, 1693.6093756 , 1709.19251933,\n       1702.55213783, 1664.309629  , 1722.30179328])"},"execution_count":40}],"source":"Current_Import_result_lr"},{"cell_type":"code","execution_count":41,"id":"funky-diagnosis","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"79DC2B67C80F4DBF971266F9CB731A31","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/79DC2B67C80F4DBF971266F9CB731A31/qtww9lrkqw.png\">"}},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}}],"source":"visual(Current_Import_result_lr,testset,\"Current_Import\")"},{"cell_type":"code","execution_count":42,"id":"historic-orchestra","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"2E659314512D4F0981AC92482B36C4C4","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/2E659314512D4F0981AC92482B36C4C4/qtwwav6qbl.png\">"}},{"output_type":"stream","text":"score: 197452.1481236473\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/2E659314512D4F0981AC92482B36C4C4/qtwwavqk3n.png\">"}},{"output_type":"stream","text":"score: 237846.78919818017\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/2E659314512D4F0981AC92482B36C4C4/qtwwaw8ng8.png\">"}},{"output_type":"stream","text":"score: 243026.78525242954\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/2E659314512D4F0981AC92482B36C4C4/qtwwaw7a6b.png\">"}},{"output_type":"stream","text":"score: 223282.42984831586\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/2E659314512D4F0981AC92482B36C4C4/qtwwawaql0.png\">"}},{"output_type":"stream","text":"score: 182228.02564100843\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/2E659314512D4F0981AC92482B36C4C4/qtwwawg7u2.png\">"}},{"output_type":"stream","text":"score: 235539.15399860425\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}}],"source":"Current_import=multi_model_eva(full_data, 'Current_Import')\nfor i in Current_Exporttol:\n    visual(i,testset,\"Current_Import\")\n    score_test(i,testset[\"Current_Import\"])"},{"cell_type":"markdown","id":"impossible-nowhere","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"B014559587A04198B6AF47D24B623E00","trusted":true,"mdEditEnable":false},"source":"**选取模型**Current_import出口含量，模型选择第五个模型"},{"cell_type":"code","execution_count":45,"id":"passive-requirement","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"62D78347762B49D58C9836DDB1ED0C60","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"execute_result","metadata":{},"data":{"text/plain":"array([1681.50668571, 1485.07315271, 1647.41320333, 1684.3647983 ,\n       1666.00575508, 1633.41990872, 1677.08494558, 1685.00506022,\n       1681.73136616, 1660.05451692, 1691.00956483])"},"execution_count":45}],"source":"Current_import[4]"},{"cell_type":"markdown","id":"regular-astronomy","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"DFEE624A017E4AA087467E29955D9F93","trusted":true,"mdEditEnable":false},"source":"#### 2、M2值预测"},{"cell_type":"code","execution_count":46,"id":"daily-laundry","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"6257EB03BCBD435789D02C00BF3A589B","trusted":true,"collapsed":false,"scrolled":false},"outputs":[],"source":"file_labels=[\"Current_Export\",\"Current_Import\",\"M2\",\"M1\",\"M0\",\"FE_Reserve\",\"Gold_Reserve\",\"Fis_Current_Month_Value\",\"Nation_Current_Month\",\"City_Current_Month\",\"Country_Current_Month\"]\nfile_path=\"base_M2.csv\"\ndataset=pd.read_csv(\"./特征工程/\"+file_path)\ndataset[\"Month\"]=pd.to_datetime(dataset[\"Month\"])\ndataset=dataset.set_index(\"Month\")"},{"cell_type":"code","execution_count":47,"id":"contrary-modeling","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"50A216D70F234FB4800ADA83EA20B0B2","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"execute_result","metadata":{},"data":{"text/plain":"            M2__sum_values  \\\nMonth                        \n2008-01-01       417846.17   \n2008-02-01       421037.84   \n2008-03-01       423054.53   \n2008-04-01       429313.72   \n2008-05-01       436221.60   \n...                    ...   \n2022-08-01             NaN   \n2022-09-01             NaN   \n2022-10-01             NaN   \n2022-11-01             NaN   \n2022-12-01             NaN   \n\n            M2__cwt_coefficients__coeff_0__w_20__widths_(2, 5, 10, 20)  \\\nMonth                                                                    \n2008-01-01                                       81036.994970            \n2008-02-01                                       81655.986752            \n2008-03-01                                       82047.103171            \n2008-04-01                                       83261.009113            \n2008-05-01                                       84600.721851            \n...                                                       ...            \n2022-08-01                                                NaN            \n2022-09-01                                                NaN            \n2022-10-01                                                NaN            \n2022-11-01                                                NaN            \n2022-12-01                                                NaN            \n\n            M2__cwt_coefficients__coeff_0__w_10__widths_(2, 5, 10, 20)  \\\nMonth                                                                    \n2008-01-01                                      114603.617340            \n2008-02-01                                      115479.003914            \n2008-03-01                                      116032.126057            \n2008-04-01                                      117748.848304            \n2008-05-01                                      119643.488229            \n...                                                       ...            \n2022-08-01                                                NaN            \n2022-09-01                                                NaN            \n2022-10-01                                                NaN            \n2022-11-01                                                NaN            \n2022-12-01                                                NaN            \n\n            M2__cwt_coefficients__coeff_0__w_5__widths_(2, 5, 10, 20)  \\\nMonth                                                                   \n2008-01-01                                      162073.989939           \n2008-02-01                                      163311.973505           \n2008-03-01                                      164094.206341           \n2008-04-01                                      166522.018225           \n2008-05-01                                      169201.443703           \n...                                                       ...           \n2022-08-01                                                NaN           \n2022-09-01                                                NaN           \n2022-10-01                                                NaN           \n2022-11-01                                                NaN           \n2022-12-01                                                NaN           \n\n            M2__cwt_coefficients__coeff_0__w_2__widths_(2, 5, 10, 20)  \\\nMonth                                                                   \n2008-01-01                                      256261.478839           \n2008-02-01                                      258218.902726           \n2008-03-01                                      259455.721438           \n2008-04-01                                      263294.429080           \n2008-05-01                                      267530.972745           \n...                                                       ...           \n2022-08-01                                                NaN           \n2022-09-01                                                NaN           \n2022-10-01                                                NaN           \n2022-11-01                                                NaN           \n2022-12-01                                                NaN           \n\n            M2__quantile__q_0.9  M2__quantile__q_0.8  M2__quantile__q_0.7  \\\nMonth                                                                       \n2008-01-01            417846.17            417846.17            417846.17   \n2008-02-01            421037.84            421037.84            421037.84   \n2008-03-01            423054.53            423054.53            423054.53   \n2008-04-01            429313.72            429313.72            429313.72   \n2008-05-01            436221.60            436221.60            436221.60   \n...                         ...                  ...                  ...   \n2022-08-01                  NaN                  NaN                  NaN   \n2022-09-01                  NaN                  NaN                  NaN   \n2022-10-01                  NaN                  NaN                  NaN   \n2022-11-01                  NaN                  NaN                  NaN   \n2022-12-01                  NaN                  NaN                  NaN   \n\n            M2__quantile__q_0.6  M2__fft_coefficient__attr_\"real\"__coeff_0  \\\nMonth                                                                        \n2008-01-01            417846.17                                  417846.17   \n2008-02-01            421037.84                                  421037.84   \n2008-03-01            423054.53                                  423054.53   \n2008-04-01            429313.72                                  429313.72   \n2008-05-01            436221.60                                  436221.60   \n...                         ...                                        ...   \n2022-08-01                  NaN                                        NaN   \n2022-09-01                  NaN                                        NaN   \n2022-10-01                  NaN                                        NaN   \n2022-11-01                  NaN                                        NaN   \n2022-12-01                  NaN                                        NaN   \n\n            ...  M2__quantile__q_0.1  M2__minimum  M2__maximum   M2__mean  \\\nMonth       ...                                                             \n2008-01-01  ...            417846.17    417846.17    417846.17  417846.17   \n2008-02-01  ...            421037.84    421037.84    421037.84  421037.84   \n2008-03-01  ...            423054.53    423054.53    423054.53  423054.53   \n2008-04-01  ...            429313.72    429313.72    429313.72  429313.72   \n2008-05-01  ...            436221.60    436221.60    436221.60  436221.60   \n...         ...                  ...          ...          ...        ...   \n2022-08-01  ...                  NaN          NaN          NaN        NaN   \n2022-09-01  ...                  NaN          NaN          NaN        NaN   \n2022-10-01  ...                  NaN          NaN          NaN        NaN   \n2022-11-01  ...                  NaN          NaN          NaN        NaN   \n2022-12-01  ...                  NaN          NaN          NaN        NaN   \n\n            M2__median  M2__abs_energy  M2__quantile__q_0.3  \\\nMonth                                                         \n2008-01-01   417846.17    1.745954e+11            417846.17   \n2008-02-01   421037.84    1.772729e+11            421037.84   \n2008-03-01   423054.53    1.789751e+11            423054.53   \n2008-04-01   429313.72    1.843103e+11            429313.72   \n2008-05-01   436221.60    1.902893e+11            436221.60   \n...                ...             ...                  ...   \n2022-08-01         NaN             NaN                  NaN   \n2022-09-01         NaN             NaN                  NaN   \n2022-10-01         NaN             NaN                  NaN   \n2022-11-01         NaN             NaN                  NaN   \n2022-12-01         NaN             NaN                  NaN   \n\n            M2__fft_coefficient__attr_\"abs\"__coeff_0  M2__benford_correlation  \\\nMonth                                                                           \n2008-01-01                                 417846.17                -0.064614   \n2008-02-01                                 421037.84                -0.064614   \n2008-03-01                                 423054.53                -0.064614   \n2008-04-01                                 429313.72                -0.064614   \n2008-05-01                                 436221.60                -0.064614   \n...                                              ...                      ...   \n2022-08-01                                       NaN                      NaN   \n2022-09-01                                       NaN                      NaN   \n2022-10-01                                       NaN                      NaN   \n2022-11-01                                       NaN                      NaN   \n2022-12-01                                       NaN                      NaN   \n\n                   M2  \nMonth                  \n2008-01-01  417846.17  \n2008-02-01  421037.84  \n2008-03-01  423054.53  \n2008-04-01  429313.72  \n2008-05-01  436221.60  \n...               ...  \n2022-08-01        NaN  \n2022-09-01        NaN  \n2022-10-01        NaN  \n2022-11-01        NaN  \n2022-12-01        NaN  \n\n[180 rows x 22 columns]","text/html":"<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>M2__sum_values</th>\n      <th>M2__cwt_coefficients__coeff_0__w_20__widths_(2, 5, 10, 20)</th>\n      <th>M2__cwt_coefficients__coeff_0__w_10__widths_(2, 5, 10, 20)</th>\n      <th>M2__cwt_coefficients__coeff_0__w_5__widths_(2, 5, 10, 20)</th>\n      <th>M2__cwt_coefficients__coeff_0__w_2__widths_(2, 5, 10, 20)</th>\n      <th>M2__quantile__q_0.9</th>\n      <th>M2__quantile__q_0.8</th>\n      <th>M2__quantile__q_0.7</th>\n      <th>M2__quantile__q_0.6</th>\n      <th>M2__fft_coefficient__attr_\"real\"__coeff_0</th>\n      <th>...</th>\n      <th>M2__quantile__q_0.1</th>\n      <th>M2__minimum</th>\n      <th>M2__maximum</th>\n      <th>M2__mean</th>\n      <th>M2__median</th>\n      <th>M2__abs_energy</th>\n      <th>M2__quantile__q_0.3</th>\n      <th>M2__fft_coefficient__attr_\"abs\"__coeff_0</th>\n      <th>M2__benford_correlation</th>\n      <th>M2</th>\n    </tr>\n    <tr>\n      <th>Month</th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <td>2008-01-01</td>\n      <td>417846.17</td>\n      <td>81036.994970</td>\n      <td>114603.617340</td>\n      <td>162073.989939</td>\n      <td>256261.478839</td>\n      <td>417846.17</td>\n      <td>417846.17</td>\n      <td>417846.17</td>\n      <td>417846.17</td>\n      <td>417846.17</td>\n      <td>...</td>\n      <td>417846.17</td>\n      <td>417846.17</td>\n      <td>417846.17</td>\n      <td>417846.17</td>\n      <td>417846.17</td>\n      <td>1.745954e+11</td>\n      <td>417846.17</td>\n      <td>417846.17</td>\n      <td>-0.064614</td>\n      <td>417846.17</td>\n    </tr>\n    <tr>\n      <td>2008-02-01</td>\n      <td>421037.84</td>\n      <td>81655.986752</td>\n      <td>115479.003914</td>\n      <td>163311.973505</td>\n      <td>258218.902726</td>\n      <td>421037.84</td>\n      <td>421037.84</td>\n      <td>421037.84</td>\n      <td>421037.84</td>\n      <td>421037.84</td>\n      <td>...</td>\n      <td>421037.84</td>\n      <td>421037.84</td>\n      <td>421037.84</td>\n      <td>421037.84</td>\n      <td>421037.84</td>\n      <td>1.772729e+11</td>\n      <td>421037.84</td>\n      <td>421037.84</td>\n      <td>-0.064614</td>\n      <td>421037.84</td>\n    </tr>\n    <tr>\n      <td>2008-03-01</td>\n      <td>423054.53</td>\n      <td>82047.103171</td>\n      <td>116032.126057</td>\n      <td>164094.206341</td>\n      <td>259455.721438</td>\n      <td>423054.53</td>\n      <td>423054.53</td>\n      <td>423054.53</td>\n      <td>423054.53</td>\n      <td>423054.53</td>\n      <td>...</td>\n      <td>423054.53</td>\n      <td>423054.53</td>\n      <td>423054.53</td>\n      <td>423054.53</td>\n      <td>423054.53</td>\n      <td>1.789751e+11</td>\n      <td>423054.53</td>\n      <td>423054.53</td>\n      <td>-0.064614</td>\n      <td>423054.53</td>\n    </tr>\n    <tr>\n      <td>2008-04-01</td>\n      <td>429313.72</td>\n      <td>83261.009113</td>\n      <td>117748.848304</td>\n      <td>166522.018225</td>\n      <td>263294.429080</td>\n      <td>429313.72</td>\n      <td>429313.72</td>\n      <td>429313.72</td>\n      <td>429313.72</td>\n      <td>429313.72</td>\n      <td>...</td>\n      <td>429313.72</td>\n      <td>429313.72</td>\n      <td>429313.72</td>\n      <td>429313.72</td>\n      <td>429313.72</td>\n      <td>1.843103e+11</td>\n      <td>429313.72</td>\n      <td>429313.72</td>\n      <td>-0.064614</td>\n      <td>429313.72</td>\n    </tr>\n    <tr>\n      <td>2008-05-01</td>\n      <td>436221.60</td>\n      <td>84600.721851</td>\n      <td>119643.488229</td>\n      <td>169201.443703</td>\n      <td>267530.972745</td>\n      <td>436221.60</td>\n      <td>436221.60</td>\n      <td>436221.60</td>\n      <td>436221.60</td>\n      <td>436221.60</td>\n      <td>...</td>\n      <td>436221.60</td>\n      <td>436221.60</td>\n      <td>436221.60</td>\n      <td>436221.60</td>\n      <td>436221.60</td>\n      <td>1.902893e+11</td>\n      <td>436221.60</td>\n      <td>436221.60</td>\n      <td>-0.064614</td>\n      <td>436221.60</td>\n    </tr>\n    <tr>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <td>2022-08-01</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>2022-09-01</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>2022-10-01</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>2022-11-01</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>2022-12-01</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n  </tbody>\n</table>\n<p>180 rows × 22 columns</p>\n</div>"},"execution_count":47}],"source":"dataset"},{"cell_type":"code","execution_count":48,"id":"circular-nitrogen","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"47EA74CD1DB64F2D8F9393D6C9C89725","trusted":true,"collapsed":false,"scrolled":false},"outputs":[],"source":"feature=[ i for i in dataset.columns  if i not in [\"Month\",\"M2\"]]\ndata=dataset[feature].shift(12)\ndata=data.dropna()\ntarge_data=pd.DataFrame(dataset[[\"M2\"]])\ntarge_data.reset_index(inplace=True)\nfull_data=pd.merge(data,targe_data,on=\"Month\")"},{"cell_type":"code","execution_count":49,"id":"martial-disposition","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"7DC5BD55EA874909848644AAA74BEF1F","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"execute_result","metadata":{},"data":{"text/plain":"         Month  M2__sum_values  \\\n0   2009-01-01       417846.17   \n1   2009-02-01       421037.84   \n2   2009-03-01       423054.53   \n3   2009-04-01       429313.72   \n4   2009-05-01       436221.60   \n..         ...             ...   \n153 2021-10-01      2149700.00   \n154 2021-11-01      2172000.00   \n155 2021-12-01      2186800.00   \n156 2022-01-01      2213000.00   \n157 2022-02-01      2236000.00   \n\n     M2__cwt_coefficients__coeff_0__w_20__widths_(2, 5, 10, 20)  \\\n0                                         81036.994970            \n1                                         81655.986752            \n2                                         82047.103171            \n3                                         83261.009113            \n4                                         84600.721851            \n..                                                 ...            \n153                                      416912.348595            \n154                                      421237.205726            \n155                                      424107.514494            \n156                                      429188.736773            \n157                                      433649.351751            \n\n     M2__cwt_coefficients__coeff_0__w_10__widths_(2, 5, 10, 20)  \\\n0                                        114603.617340            \n1                                        115479.003914            \n2                                        116032.126057            \n3                                        117748.848304            \n4                                        119643.488229            \n..                                                 ...            \n153                                      589603.097704            \n154                                      595719.369313            \n155                                      599778.598901            \n156                                      606964.532362            \n157                                      613272.794560            \n\n     M2__cwt_coefficients__coeff_0__w_5__widths_(2, 5, 10, 20)  \\\n0                                        162073.989939           \n1                                        163311.973505           \n2                                        164094.206341           \n3                                        166522.018225           \n4                                        169201.443703           \n..                                                 ...           \n153                                      833824.697190           \n154                                      842474.411451           \n155                                      848215.028988           \n156                                      858377.473546           \n157                                      867298.703501           \n\n     M2__cwt_coefficients__coeff_0__w_2__widths_(2, 5, 10, 20)  \\\n0                                         2.562615e+05           \n1                                         2.582189e+05           \n2                                         2.594557e+05           \n3                                         2.632944e+05           \n4                                         2.675310e+05           \n..                                                 ...           \n153                                       1.318393e+06           \n154                                       1.332069e+06           \n155                                       1.341146e+06           \n156                                       1.357214e+06           \n157                                       1.371320e+06           \n\n     M2__quantile__q_0.9  M2__quantile__q_0.8  M2__quantile__q_0.7  \\\n0              417846.17            417846.17            417846.17   \n1              421037.84            421037.84            421037.84   \n2              423054.53            423054.53            423054.53   \n3              429313.72            429313.72            429313.72   \n4              436221.60            436221.60            436221.60   \n..                   ...                  ...                  ...   \n153           2149700.00           2149700.00           2149700.00   \n154           2172000.00           2172000.00           2172000.00   \n155           2186800.00           2186800.00           2186800.00   \n156           2213000.00           2213000.00           2213000.00   \n157           2236000.00           2236000.00           2236000.00   \n\n     M2__quantile__q_0.6  ...  M2__quantile__q_0.1  M2__minimum  M2__maximum  \\\n0              417846.17  ...            417846.17    417846.17    417846.17   \n1              421037.84  ...            421037.84    421037.84    421037.84   \n2              423054.53  ...            423054.53    423054.53    423054.53   \n3              429313.72  ...            429313.72    429313.72    429313.72   \n4              436221.60  ...            436221.60    436221.60    436221.60   \n..                   ...  ...                  ...          ...          ...   \n153           2149700.00  ...           2149700.00   2149700.00   2149700.00   \n154           2172000.00  ...           2172000.00   2172000.00   2172000.00   \n155           2186800.00  ...           2186800.00   2186800.00   2186800.00   \n156           2213000.00  ...           2213000.00   2213000.00   2213000.00   \n157           2236000.00  ...           2236000.00   2236000.00   2236000.00   \n\n       M2__mean  M2__median  M2__abs_energy  M2__quantile__q_0.3  \\\n0     417846.17   417846.17    1.745954e+11            417846.17   \n1     421037.84   421037.84    1.772729e+11            421037.84   \n2     423054.53   423054.53    1.789751e+11            423054.53   \n3     429313.72   429313.72    1.843103e+11            429313.72   \n4     436221.60   436221.60    1.902893e+11            436221.60   \n..          ...         ...             ...                  ...   \n153  2149700.00  2149700.00    4.621210e+12           2149700.00   \n154  2172000.00  2172000.00    4.717584e+12           2172000.00   \n155  2186800.00  2186800.00    4.782094e+12           2186800.00   \n156  2213000.00  2213000.00    4.897369e+12           2213000.00   \n157  2236000.00  2236000.00    4.999696e+12           2236000.00   \n\n     M2__fft_coefficient__attr_\"abs\"__coeff_0  M2__benford_correlation  \\\n0                                   417846.17                -0.064614   \n1                                   421037.84                -0.064614   \n2                                   423054.53                -0.064614   \n3                                   429313.72                -0.064614   \n4                                   436221.60                -0.064614   \n..                                        ...                      ...   \n153                                2149700.00                 0.295657   \n154                                2172000.00                 0.295657   \n155                                2186800.00                 0.295657   \n156                                2213000.00                 0.295657   \n157                                2236000.00                 0.295657   \n\n            M2  \n0    496135.31  \n1    506708.07  \n2    530626.71  \n3    540481.21  \n4    548263.51  \n..         ...  \n153        NaN  \n154        NaN  \n155        NaN  \n156        NaN  \n157        NaN  \n\n[158 rows x 23 columns]","text/html":"<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Month</th>\n      <th>M2__sum_values</th>\n      <th>M2__cwt_coefficients__coeff_0__w_20__widths_(2, 5, 10, 20)</th>\n      <th>M2__cwt_coefficients__coeff_0__w_10__widths_(2, 5, 10, 20)</th>\n      <th>M2__cwt_coefficients__coeff_0__w_5__widths_(2, 5, 10, 20)</th>\n      <th>M2__cwt_coefficients__coeff_0__w_2__widths_(2, 5, 10, 20)</th>\n      <th>M2__quantile__q_0.9</th>\n      <th>M2__quantile__q_0.8</th>\n      <th>M2__quantile__q_0.7</th>\n      <th>M2__quantile__q_0.6</th>\n      <th>...</th>\n      <th>M2__quantile__q_0.1</th>\n      <th>M2__minimum</th>\n      <th>M2__maximum</th>\n      <th>M2__mean</th>\n      <th>M2__median</th>\n      <th>M2__abs_energy</th>\n      <th>M2__quantile__q_0.3</th>\n      <th>M2__fft_coefficient__attr_\"abs\"__coeff_0</th>\n      <th>M2__benford_correlation</th>\n      <th>M2</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <td>0</td>\n      <td>2009-01-01</td>\n      <td>417846.17</td>\n      <td>81036.994970</td>\n      <td>114603.617340</td>\n      <td>162073.989939</td>\n      <td>2.562615e+05</td>\n      <td>417846.17</td>\n      <td>417846.17</td>\n      <td>417846.17</td>\n      <td>417846.17</td>\n      <td>...</td>\n      <td>417846.17</td>\n      <td>417846.17</td>\n      <td>417846.17</td>\n      <td>417846.17</td>\n      <td>417846.17</td>\n      <td>1.745954e+11</td>\n      <td>417846.17</td>\n      <td>417846.17</td>\n      <td>-0.064614</td>\n      <td>496135.31</td>\n    </tr>\n    <tr>\n      <td>1</td>\n      <td>2009-02-01</td>\n      <td>421037.84</td>\n      <td>81655.986752</td>\n      <td>115479.003914</td>\n      <td>163311.973505</td>\n      <td>2.582189e+05</td>\n      <td>421037.84</td>\n      <td>421037.84</td>\n      <td>421037.84</td>\n      <td>421037.84</td>\n      <td>...</td>\n      <td>421037.84</td>\n      <td>421037.84</td>\n      <td>421037.84</td>\n      <td>421037.84</td>\n      <td>421037.84</td>\n      <td>1.772729e+11</td>\n      <td>421037.84</td>\n      <td>421037.84</td>\n      <td>-0.064614</td>\n      <td>506708.07</td>\n    </tr>\n    <tr>\n      <td>2</td>\n      <td>2009-03-01</td>\n      <td>423054.53</td>\n      <td>82047.103171</td>\n      <td>116032.126057</td>\n      <td>164094.206341</td>\n      <td>2.594557e+05</td>\n      <td>423054.53</td>\n      <td>423054.53</td>\n      <td>423054.53</td>\n      <td>423054.53</td>\n      <td>...</td>\n      <td>423054.53</td>\n      <td>423054.53</td>\n      <td>423054.53</td>\n      <td>423054.53</td>\n      <td>423054.53</td>\n      <td>1.789751e+11</td>\n      <td>423054.53</td>\n      <td>423054.53</td>\n      <td>-0.064614</td>\n      <td>530626.71</td>\n    </tr>\n    <tr>\n      <td>3</td>\n      <td>2009-04-01</td>\n      <td>429313.72</td>\n      <td>83261.009113</td>\n      <td>117748.848304</td>\n      <td>166522.018225</td>\n      <td>2.632944e+05</td>\n      <td>429313.72</td>\n      <td>429313.72</td>\n      <td>429313.72</td>\n      <td>429313.72</td>\n      <td>...</td>\n      <td>429313.72</td>\n      <td>429313.72</td>\n      <td>429313.72</td>\n      <td>429313.72</td>\n      <td>429313.72</td>\n      <td>1.843103e+11</td>\n      <td>429313.72</td>\n      <td>429313.72</td>\n      <td>-0.064614</td>\n      <td>540481.21</td>\n    </tr>\n    <tr>\n      <td>4</td>\n      <td>2009-05-01</td>\n      <td>436221.60</td>\n      <td>84600.721851</td>\n      <td>119643.488229</td>\n      <td>169201.443703</td>\n      <td>2.675310e+05</td>\n      <td>436221.60</td>\n      <td>436221.60</td>\n      <td>436221.60</td>\n      <td>436221.60</td>\n      <td>...</td>\n      <td>436221.60</td>\n      <td>436221.60</td>\n      <td>436221.60</td>\n      <td>436221.60</td>\n      <td>436221.60</td>\n      <td>1.902893e+11</td>\n      <td>436221.60</td>\n      <td>436221.60</td>\n      <td>-0.064614</td>\n      <td>548263.51</td>\n    </tr>\n    <tr>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <td>153</td>\n      <td>2021-10-01</td>\n      <td>2149700.00</td>\n      <td>416912.348595</td>\n      <td>589603.097704</td>\n      <td>833824.697190</td>\n      <td>1.318393e+06</td>\n      <td>2149700.00</td>\n      <td>2149700.00</td>\n      <td>2149700.00</td>\n      <td>2149700.00</td>\n      <td>...</td>\n      <td>2149700.00</td>\n      <td>2149700.00</td>\n      <td>2149700.00</td>\n      <td>2149700.00</td>\n      <td>2149700.00</td>\n      <td>4.621210e+12</td>\n      <td>2149700.00</td>\n      <td>2149700.00</td>\n      <td>0.295657</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>154</td>\n      <td>2021-11-01</td>\n      <td>2172000.00</td>\n      <td>421237.205726</td>\n      <td>595719.369313</td>\n      <td>842474.411451</td>\n      <td>1.332069e+06</td>\n      <td>2172000.00</td>\n      <td>2172000.00</td>\n      <td>2172000.00</td>\n      <td>2172000.00</td>\n      <td>...</td>\n      <td>2172000.00</td>\n      <td>2172000.00</td>\n      <td>2172000.00</td>\n      <td>2172000.00</td>\n      <td>2172000.00</td>\n      <td>4.717584e+12</td>\n      <td>2172000.00</td>\n      <td>2172000.00</td>\n      <td>0.295657</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>155</td>\n      <td>2021-12-01</td>\n      <td>2186800.00</td>\n      <td>424107.514494</td>\n      <td>599778.598901</td>\n      <td>848215.028988</td>\n      <td>1.341146e+06</td>\n      <td>2186800.00</td>\n      <td>2186800.00</td>\n      <td>2186800.00</td>\n      <td>2186800.00</td>\n      <td>...</td>\n      <td>2186800.00</td>\n      <td>2186800.00</td>\n      <td>2186800.00</td>\n      <td>2186800.00</td>\n      <td>2186800.00</td>\n      <td>4.782094e+12</td>\n      <td>2186800.00</td>\n      <td>2186800.00</td>\n      <td>0.295657</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>156</td>\n      <td>2022-01-01</td>\n      <td>2213000.00</td>\n      <td>429188.736773</td>\n      <td>606964.532362</td>\n      <td>858377.473546</td>\n      <td>1.357214e+06</td>\n      <td>2213000.00</td>\n      <td>2213000.00</td>\n      <td>2213000.00</td>\n      <td>2213000.00</td>\n      <td>...</td>\n      <td>2213000.00</td>\n      <td>2213000.00</td>\n      <td>2213000.00</td>\n      <td>2213000.00</td>\n      <td>2213000.00</td>\n      <td>4.897369e+12</td>\n      <td>2213000.00</td>\n      <td>2213000.00</td>\n      <td>0.295657</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>157</td>\n      <td>2022-02-01</td>\n      <td>2236000.00</td>\n      <td>433649.351751</td>\n      <td>613272.794560</td>\n      <td>867298.703501</td>\n      <td>1.371320e+06</td>\n      <td>2236000.00</td>\n      <td>2236000.00</td>\n      <td>2236000.00</td>\n      <td>2236000.00</td>\n      <td>...</td>\n      <td>2236000.00</td>\n      <td>2236000.00</td>\n      <td>2236000.00</td>\n      <td>2236000.00</td>\n      <td>2236000.00</td>\n      <td>4.999696e+12</td>\n      <td>2236000.00</td>\n      <td>2236000.00</td>\n      <td>0.295657</td>\n      <td>NaN</td>\n    </tr>\n  </tbody>\n</table>\n<p>158 rows × 23 columns</p>\n</div>"},"execution_count":49}],"source":"full_data"},{"cell_type":"code","execution_count":50,"id":"eastern-sperm","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"A149C27AB2874B82BBC6247D44F98414","trusted":true,"collapsed":false,"scrolled":false},"outputs":[],"source":"result_lr = generate_result(full_data,feature=feature,target=\"M2\")"},{"cell_type":"code","execution_count":51,"id":"nominated-tender","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"BDD149F4769D4ED18E44104B88FDA53F","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"execute_result","metadata":{},"data":{"text/plain":"array([2036427.19498368, 2037997.16152638, 2061132.11260583,\n       2056141.68660323, 2062965.05543761, 2094762.66953005,\n       2092710.26649578, 2109643.30710193, 2127292.11018384,\n       2120288.27787647, 2136960.58973052])"},"execution_count":51}],"source":"result_lr"},{"cell_type":"code","execution_count":52,"id":"shared-somerset","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"9A36D1EFD60F469186FA93A8E90B2148","trusted":true,"collapsed":false,"scrolled":false},"outputs":[],"source":"trainset, testset = split_data(full_data)\nmultirsult=multi_model_eva(full_data, 'M2')"},{"cell_type":"code","execution_count":53,"id":"dedicated-positive","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"3D4CC48080194025A64991D1A2129832","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"execute_result","metadata":{},"data":{"text/plain":"[array([2036427.19498368, 2037997.16152638, 2061132.11260583,\n        2056141.68660323, 2062965.05543761, 2094762.66953005,\n        2092710.26649578, 2109643.30710193, 2127292.11018384,\n        2120288.27787647, 2136960.58973052]),\n array([2023066.49, 2030830.42, 2080923.41, 2093533.83, 2100183.74,\n        2134948.66, 2125458.46, 2136800.  , 2164100.  , 2149700.  ,\n        2172000.  ]),\n array([2036675.309, 2041333.667, 2081027.219, 2082884.312, 2088731.351,\n        2130388.694, 2127541.634, 2135821.692, 2162800.   , 2152080.   ,\n        2168980.   ]),\n array([2024832.70096316, 2030852.09303195, 2083146.37115395,\n        2091015.76216171, 2099894.47160986, 2134737.76043675,\n        2125459.00158055, 2136625.4956445 , 2163791.26543174,\n        2149507.97467113, 2171240.47076031]),\n array([2363702.24247125, 2367180.15169671, 2418717.28429559,\n        2407554.8096557 , 2422823.44371942, 2494592.62261346,\n        2489929.62514642, 2528527.19886163, 2569061.90976861,\n        2552938.60769037, 2591400.07732537]),\n array([2023113.2, 2030835.4, 2081386.2, 2092940.6, 2100260.5, 2135313.2,\n        2125147.8, 2136807.8, 2164066.8, 2149662.2, 2171766.5],\n       dtype=float32)]"},"execution_count":53}],"source":"multirsult"},{"cell_type":"code","execution_count":54,"id":"disturbed-circular","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"3BB9C66C18774B7D89B47645A2A6E9D9","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/3BB9C66C18774B7D89B47645A2A6E9D9/qtwwf7g9ez.png\">"}},{"output_type":"stream","text":"score: 934313031.1540364\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/3BB9C66C18774B7D89B47645A2A6E9D9/qtwwf7ctdl.png\">"}},{"output_type":"stream","text":"score: 0.0\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/3BB9C66C18774B7D89B47645A2A6E9D9/qtwwf7jzce.png\">"}},{"output_type":"stream","text":"score: 52969378.74947398\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/3BB9C66C18774B7D89B47645A2A6E9D9/qtwwf7gk8a.png\">"}},{"output_type":"stream","text":"score: 1388170.466738726\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/3BB9C66C18774B7D89B47645A2A6E9D9/qtwwf8q4ea.png\">"}},{"output_type":"stream","text":"score: 133099933619.75659\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/3BB9C66C18774B7D89B47645A2A6E9D9/qtwwf8rxvi.png\">"}},{"output_type":"stream","text":"score: 78254.15405000014\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}}],"source":"for i in multirsult:\n    visual(i,testset,\"M2\")\n    score_test(i,testset[\"M2\"])"},{"cell_type":"markdown","id":"herbal-coach","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"19766D2EBEB2406D84C79FB58DA0199E","trusted":true,"mdEditEnable":false},"source":"M2的选择我们选择，决策树回归也就是第二个"},{"cell_type":"code","execution_count":55,"id":"powerful-broadcasting","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"411DEE48080F414B865F924B33365224","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"execute_result","metadata":{},"data":{"text/plain":"array([2023066.49, 2030830.42, 2080923.41, 2093533.83, 2100183.74,\n       2134948.66, 2125458.46, 2136800.  , 2164100.  , 2149700.  ,\n       2172000.  ])"},"execution_count":55}],"source":"multirsult[1]"},{"cell_type":"markdown","id":"professional-appraisal","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"50538C71C4944AB38F9E3717F9D77AF7","trusted":true,"mdEditEnable":false},"source":" #### 3、M1值预测"},{"cell_type":"code","execution_count":56,"id":"cardiac-disney","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"28AD4E4C08E4418D828F8651DAF0EBA8","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/28AD4E4C08E4418D828F8651DAF0EBA8/qtwwj596cm.png\">"}},{"output_type":"stream","text":"score: 284730837.8240185\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/28AD4E4C08E4418D828F8651DAF0EBA8/qtwwj61dho.png\">"}},{"output_type":"stream","text":"score: 0.0\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/28AD4E4C08E4418D828F8651DAF0EBA8/qtwwj6treu.png\">"}},{"output_type":"stream","text":"score: 27748536.437190816\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/28AD4E4C08E4418D828F8651DAF0EBA8/qtwwj6dzn2.png\">"}},{"output_type":"stream","text":"score: 11338200.549038868\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/28AD4E4C08E4418D828F8651DAF0EBA8/qtwwj6tahn.png\">"}},{"output_type":"stream","text":"score: 1994185244.4883738\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/28AD4E4C08E4418D828F8651DAF0EBA8/qtwwj6oa8l.png\">"}},{"output_type":"stream","text":"score: 244502.9087335237\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}}],"source":"file_labels=[\"Current_Export\",\"Current_Import\",\"M2\",\"M1\",\"M0\",\"FE_Reserve\",\"Gold_Reserve\",\"Fis_Current_Month_Value\",\"Nation_Current_Month\",\"City_Current_Month\",\"Country_Current_Month\"]\nfile_path=\"base_M1.csv\"\ndataset=pd.read_csv(\"./特征工程/\"+file_path)\ndataset[\"Month\"]=pd.to_datetime(dataset[\"Month\"])\ndataset=dataset.set_index(\"Month\")\nfeature=[ i for i in dataset.columns  if i not in [\"Month\",\"M1\"]]\ndata=dataset[feature].shift(12)\ndata=data.dropna()\ntarge_data=pd.DataFrame(dataset[[\"M1\"]])\ntarge_data.reset_index(inplace=True)\nfull_data=pd.merge(data,targe_data,on=\"Month\")\nresult_lr = generate_result(full_data,feature=feature,target=\"M1\")\ntrainset, testset = split_data(full_data)\nmultir_result=multi_model_eva(full_data, 'M1')\nfor i in multir_result:\n    visual(i,testset,\"M1\")\n    score_test(i,testset[\"M1\"])"},{"cell_type":"code","execution_count":57,"id":"sixth-gather","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"3654135C0C0B438D8BC2CA033189E923","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"execute_result","metadata":{},"data":{"text/plain":"array([545531.79, 552700.73, 575050.29, 570150.48, 581111.06, 604317.97,\n       591192.64, 601300.  , 602300.  , 609200.  , 618600.  ])"},"execution_count":57}],"source":"# 模型选择决策数\nmultir_result[1]"},{"cell_type":"markdown","id":"dried-manhattan","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"11CE56D6E604407B9C59EAE542F85BA0","trusted":true,"mdEditEnable":false},"source":"#### 4、M0值预测"},{"cell_type":"code","execution_count":58,"id":"honey-budapest","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"7B2F21C35D23424E98912844EB461B87","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/7B2F21C35D23424E98912844EB461B87/qtwwlx1eik.png\">"}},{"output_type":"stream","text":"score: 17505912.697778463\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/7B2F21C35D23424E98912844EB461B87/qtwwlx39g1.png\">"}},{"output_type":"stream","text":"score: 0.0\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/7B2F21C35D23424E98912844EB461B87/qtwwlymep9.png\">"}},{"output_type":"stream","text":"score: 6666352.75587691\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/7B2F21C35D23424E98912844EB461B87/qtwwly6p1z.png\">"}},{"output_type":"stream","text":"score: 459702.23063172173\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/7B2F21C35D23424E98912844EB461B87/qtwwlys2mc.png\">"}},{"output_type":"stream","text":"score: 207063129.38845298\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/7B2F21C35D23424E98912844EB461B87/qtwwlyj0eu.png\">"}},{"output_type":"stream","text":"score: 2295.373349840223\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}}],"source":"file_labels=[\"Current_Export\",\"Current_Import\",\"M2\",\"M1\",\"M0\",\"FE_Reserve\",\"Gold_Reserve\",\"Fis_Current_Month_Value\",\"Nation_Current_Month\",\"City_Current_Month\",\"Country_Current_Month\"]\nfile_path=\"base_M0.csv\"\ndataset=pd.read_csv(\"./特征工程/\"+file_path)\ndataset[\"Month\"]=pd.to_datetime(dataset[\"Month\"])\ndataset=dataset.set_index(\"Month\")\nfeature=[ i for i in dataset.columns  if i not in [\"Month\",\"M0\"]]\ndata=dataset[feature].shift(12)\ndata=data.dropna()\ntarge_data=pd.DataFrame(dataset[[\"M0\"]])\ntarge_data.reset_index(inplace=True)\nfull_data=pd.merge(data,targe_data,on=\"Month\")\nresult_lr = generate_result(full_data,feature=feature,target=\"M0\")\ntrainset, testset = split_data(full_data)\nmultir_result=multi_model_eva(full_data, 'M0')\nfor i in multir_result:\n    visual(i,testset,\"M0\")\n    score_test(i,testset[\"M0\"])"},{"cell_type":"code","execution_count":59,"id":"furnished-brand","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"A9A6668597EF4DFBBF32DA43DBCF2B51","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"execute_result","metadata":{},"data":{"text/plain":"array([93249.16, 88187.05, 83022.21, 81485.21, 79706.83, 79459.41,\n       79867.21, 80000.  , 82400.  , 81000.  , 81600.  ])"},"execution_count":59}],"source":"# 选择决策树\nmultir_result[1]"},{"cell_type":"markdown","id":"disabled-digest","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"4BAF3A4B77C9416C80FAADAF9D15EBF6","trusted":true,"mdEditEnable":false},"source":"#### 5、国家外汇储备(亿美元)预测"},{"cell_type":"code","execution_count":60,"id":"spread-revelation","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"ED1869E0F4D6493F87C6B1B93BE94A31","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/ED1869E0F4D6493F87C6B1B93BE94A31/qtwwq6f7fw.png\">"}},{"output_type":"stream","text":"score: 1009903.9098311986\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/ED1869E0F4D6493F87C6B1B93BE94A31/qtwwq6l4i1.png\">"}},{"output_type":"stream","text":"score: 0.0\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/ED1869E0F4D6493F87C6B1B93BE94A31/qtwwq7pnkb.png\">"}},{"output_type":"stream","text":"score: 40338.637769817826\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/ED1869E0F4D6493F87C6B1B93BE94A31/qtwwq7wfpq.png\">"}},{"output_type":"stream","text":"score: 113506.08317338751\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/ED1869E0F4D6493F87C6B1B93BE94A31/qtwwq7dpe.png\">"}},{"output_type":"stream","text":"score: 1740926.5204946958\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/ED1869E0F4D6493F87C6B1B93BE94A31/qtwwq7bj4f.png\">"}},{"output_type":"stream","text":"score: 12697.966990871884\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}}],"source":"file_labels=[\"Current_Export\",\"Current_Import\",\"M2\",\"M1\",\"M0\",\"FE_Reserve\",\"Gold_Reserve\",\"Fis_Current_Month_Value\",\"Nation_Current_Month\",\"City_Current_Month\",\"Country_Current_Month\"]\nfile_path=\"base_FE_Reserve.csv\"\ndataset=pd.read_csv(\"./特征工程/\"+file_path)\ndataset[\"Month\"]=pd.to_datetime(dataset[\"Month\"])\ndataset=dataset.set_index(\"Month\")\nfeature=[ i for i in dataset.columns  if i not in [\"Month\",\"FE_Reserve\"]]\ndata=dataset[feature].shift(12)\ndata=data.dropna()\ntarge_data=pd.DataFrame(dataset[[\"FE_Reserve\"]])\ntarge_data.reset_index(inplace=True)\nfull_data=pd.merge(data,targe_data,on=\"Month\")\nresult_lr = generate_result(full_data,feature=feature,target=\"FE_Reserve\")\ntrainset, testset = split_data(full_data)\nmultir_result=multi_model_eva(full_data, 'FE_Reserve')\nfor i in multir_result:\n    visual(i,testset,\"FE_Reserve\")\n    score_test(i,testset[\"FE_Reserve\"])"},{"cell_type":"code","execution_count":61,"id":"altered-mouth","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"D73EFEC46B5E40A0801BC9F946A95D69","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"execute_result","metadata":{},"data":{"text/plain":"array([31154.97, 31067.18, 30606.33, 30914.59, 31016.92, 31123.28,\n       31543.91, 31646.09, 31425.62, 31279.82, 31784.9 ])"},"execution_count":61}],"source":"# 决策树效果最好\nmultir_result[1]"},{"cell_type":"markdown","id":"bored-thanks","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"F00935CB395249B0A4A22D015FA34DAD","trusted":true,"mdEditEnable":false},"source":"#### 6、黄金储备预测"},{"cell_type":"code","execution_count":62,"id":"amazing-bahrain","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"4937C30E1A4D414B88844E6DE7AFD625","trusted":true,"collapsed":false,"scrolled":false},"outputs":[],"source":"file_labels=[\"Current_Export\",\"Current_Import\",\"M2\",\"M1\",\"M0\",\"FE_Reserve\",\"Gold_Reserve\",\"Fis_Current_Month_Value\",\"Nation_Current_Month\",\"City_Current_Month\",\"Country_Current_Month\"]\nfile_path=\"base_Gold_Reserve.csv\"\ndataset=pd.read_csv(\"./特征工程/\"+file_path)\ndataset[\"Month\"]=pd.to_datetime(dataset[\"Month\"])\ndataset=dataset.set_index(\"Month\")\nfeature=[ i for i in dataset.columns  if i not in [\"Month\",\"Gold_Reserve\"]]\ndata=dataset[feature].shift(12)\ndata=data.dropna()\ntarge_data=pd.DataFrame(dataset[[\"Gold_Reserve\"]])\ntarge_data.reset_index(inplace=True)"},{"cell_type":"code","execution_count":63,"id":"chinese-broadway","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"086A48B32AF24E2D95D1345F412DF980","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"execute_result","metadata":{},"data":{"text/plain":"         Month  Gold_Reserve\n0   2008-01-01        1929.0\n1   2008-02-01        1929.0\n2   2008-03-01        1929.0\n3   2008-04-01        1929.0\n4   2008-05-01        1929.0\n..         ...           ...\n175 2022-08-01           NaN\n176 2022-09-01           NaN\n177 2022-10-01           NaN\n178 2022-11-01           NaN\n179 2022-12-01           NaN\n\n[180 rows x 2 columns]","text/html":"<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Month</th>\n      <th>Gold_Reserve</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <td>0</td>\n      <td>2008-01-01</td>\n      <td>1929.0</td>\n    </tr>\n    <tr>\n      <td>1</td>\n      <td>2008-02-01</td>\n      <td>1929.0</td>\n    </tr>\n    <tr>\n      <td>2</td>\n      <td>2008-03-01</td>\n      <td>1929.0</td>\n    </tr>\n    <tr>\n      <td>3</td>\n      <td>2008-04-01</td>\n      <td>1929.0</td>\n    </tr>\n    <tr>\n      <td>4</td>\n      <td>2008-05-01</td>\n      <td>1929.0</td>\n    </tr>\n    <tr>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <td>175</td>\n      <td>2022-08-01</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>176</td>\n      <td>2022-09-01</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>177</td>\n      <td>2022-10-01</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>178</td>\n      <td>2022-11-01</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>179</td>\n      <td>2022-12-01</td>\n      <td>NaN</td>\n    </tr>\n  </tbody>\n</table>\n<p>180 rows × 2 columns</p>\n</div>"},"execution_count":63}],"source":"targe_data"},{"cell_type":"code","execution_count":64,"id":"russian-arrest","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"66A8631157714547871243A1A3BC5543","trusted":true,"collapsed":false,"scrolled":false},"outputs":[],"source":"full_data=pd.merge(data,targe_data,on=\"Month\")"},{"cell_type":"code","execution_count":65,"id":"realistic-glenn","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"E3186A9EE4814CC392AD222C14332F39","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"execute_result","metadata":{},"data":{"text/plain":"         Month  Gold_Reserve__sum_values  \\\n0   2009-01-01                    1929.0   \n1   2009-02-01                    1929.0   \n2   2009-03-01                    1929.0   \n3   2009-04-01                    1929.0   \n4   2009-05-01                    1929.0   \n..         ...                       ...   \n153 2021-10-01                    6264.0   \n154 2021-11-01                    6264.0   \n155 2021-12-01                    6264.0   \n156 2022-01-01                    6264.0   \n157 2022-02-01                    6264.0   \n\n     Gold_Reserve__cwt_coefficients__coeff_0__w_20__widths_(2, 5, 10, 20)  \\\n0                                           374.109839                      \n1                                           374.109839                      \n2                                           374.109839                      \n3                                           374.109839                      \n4                                           374.109839                      \n..                                                 ...                      \n153                                        1214.838792                      \n154                                        1214.838792                      \n155                                        1214.838792                      \n156                                        1214.838792                      \n157                                        1214.838792                      \n\n     Gold_Reserve__cwt_coefficients__coeff_0__w_10__widths_(2, 5, 10, 20)  \\\n0                                           529.071208                      \n1                                           529.071208                      \n2                                           529.071208                      \n3                                           529.071208                      \n4                                           529.071208                      \n..                                                 ...                      \n153                                        1718.041496                      \n154                                        1718.041496                      \n155                                        1718.041496                      \n156                                        1718.041496                      \n157                                        1718.041496                      \n\n     Gold_Reserve__cwt_coefficients__coeff_0__w_5__widths_(2, 5, 10, 20)  \\\n0                                           748.219678                     \n1                                           748.219678                     \n2                                           748.219678                     \n3                                           748.219678                     \n4                                           748.219678                     \n..                                                 ...                     \n153                                        2429.677584                     \n154                                        2429.677584                     \n155                                        2429.677584                     \n156                                        2429.677584                     \n157                                        2429.677584                     \n\n     Gold_Reserve__cwt_coefficients__coeff_0__w_2__widths_(2, 5, 10, 20)  \\\n0                                          1183.039186                     \n1                                          1183.039186                     \n2                                          1183.039186                     \n3                                          1183.039186                     \n4                                          1183.039186                     \n..                                                 ...                     \n153                                        3841.657573                     \n154                                        3841.657573                     \n155                                        3841.657573                     \n156                                        3841.657573                     \n157                                        3841.657573                     \n\n     Gold_Reserve__quantile__q_0.9  Gold_Reserve__quantile__q_0.8  \\\n0                           1929.0                         1929.0   \n1                           1929.0                         1929.0   \n2                           1929.0                         1929.0   \n3                           1929.0                         1929.0   \n4                           1929.0                         1929.0   \n..                             ...                            ...   \n153                         6264.0                         6264.0   \n154                         6264.0                         6264.0   \n155                         6264.0                         6264.0   \n156                         6264.0                         6264.0   \n157                         6264.0                         6264.0   \n\n     Gold_Reserve__quantile__q_0.7  Gold_Reserve__quantile__q_0.6  ...  \\\n0                           1929.0                         1929.0  ...   \n1                           1929.0                         1929.0  ...   \n2                           1929.0                         1929.0  ...   \n3                           1929.0                         1929.0  ...   \n4                           1929.0                         1929.0  ...   \n..                             ...                            ...  ...   \n153                         6264.0                         6264.0  ...   \n154                         6264.0                         6264.0  ...   \n155                         6264.0                         6264.0  ...   \n156                         6264.0                         6264.0  ...   \n157                         6264.0                         6264.0  ...   \n\n     Gold_Reserve__quantile__q_0.1  Gold_Reserve__minimum  \\\n0                           1929.0                 1929.0   \n1                           1929.0                 1929.0   \n2                           1929.0                 1929.0   \n3                           1929.0                 1929.0   \n4                           1929.0                 1929.0   \n..                             ...                    ...   \n153                         6264.0                 6264.0   \n154                         6264.0                 6264.0   \n155                         6264.0                 6264.0   \n156                         6264.0                 6264.0   \n157                         6264.0                 6264.0   \n\n     Gold_Reserve__maximum  Gold_Reserve__mean  Gold_Reserve__median  \\\n0                   1929.0              1929.0                1929.0   \n1                   1929.0              1929.0                1929.0   \n2                   1929.0              1929.0                1929.0   \n3                   1929.0              1929.0                1929.0   \n4                   1929.0              1929.0                1929.0   \n..                     ...                 ...                   ...   \n153                 6264.0              6264.0                6264.0   \n154                 6264.0              6264.0                6264.0   \n155                 6264.0              6264.0                6264.0   \n156                 6264.0              6264.0                6264.0   \n157                 6264.0              6264.0                6264.0   \n\n     Gold_Reserve__abs_energy  Gold_Reserve__quantile__q_0.3  \\\n0                   3721041.0                         1929.0   \n1                   3721041.0                         1929.0   \n2                   3721041.0                         1929.0   \n3                   3721041.0                         1929.0   \n4                   3721041.0                         1929.0   \n..                        ...                            ...   \n153                39237696.0                         6264.0   \n154                39237696.0                         6264.0   \n155                39237696.0                         6264.0   \n156                39237696.0                         6264.0   \n157                39237696.0                         6264.0   \n\n     Gold_Reserve__fft_coefficient__attr_\"abs\"__coeff_0  \\\n0                                               1929.0    \n1                                               1929.0    \n2                                               1929.0    \n3                                               1929.0    \n4                                               1929.0    \n..                                                 ...    \n153                                             6264.0    \n154                                             6264.0    \n155                                             6264.0    \n156                                             6264.0    \n157                                             6264.0    \n\n     Gold_Reserve__benford_correlation  Gold_Reserve  \n0                             0.864123        1929.0  \n1                             0.864123        1929.0  \n2                             0.864123        1929.0  \n3                             0.864123        3389.0  \n4                             0.864123        3389.0  \n..                                 ...           ...  \n153                          -0.200946           NaN  \n154                          -0.200946           NaN  \n155                          -0.200946           NaN  \n156                          -0.200946           NaN  \n157                          -0.200946           NaN  \n\n[158 rows x 23 columns]","text/html":"<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Month</th>\n      <th>Gold_Reserve__sum_values</th>\n      <th>Gold_Reserve__cwt_coefficients__coeff_0__w_20__widths_(2, 5, 10, 20)</th>\n      <th>Gold_Reserve__cwt_coefficients__coeff_0__w_10__widths_(2, 5, 10, 20)</th>\n      <th>Gold_Reserve__cwt_coefficients__coeff_0__w_5__widths_(2, 5, 10, 20)</th>\n      <th>Gold_Reserve__cwt_coefficients__coeff_0__w_2__widths_(2, 5, 10, 20)</th>\n      <th>Gold_Reserve__quantile__q_0.9</th>\n      <th>Gold_Reserve__quantile__q_0.8</th>\n      <th>Gold_Reserve__quantile__q_0.7</th>\n      <th>Gold_Reserve__quantile__q_0.6</th>\n      <th>...</th>\n      <th>Gold_Reserve__quantile__q_0.1</th>\n      <th>Gold_Reserve__minimum</th>\n      <th>Gold_Reserve__maximum</th>\n      <th>Gold_Reserve__mean</th>\n      <th>Gold_Reserve__median</th>\n      <th>Gold_Reserve__abs_energy</th>\n      <th>Gold_Reserve__quantile__q_0.3</th>\n      <th>Gold_Reserve__fft_coefficient__attr_\"abs\"__coeff_0</th>\n      <th>Gold_Reserve__benford_correlation</th>\n      <th>Gold_Reserve</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <td>0</td>\n      <td>2009-01-01</td>\n      <td>1929.0</td>\n      <td>374.109839</td>\n      <td>529.071208</td>\n      <td>748.219678</td>\n      <td>1183.039186</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>...</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>3721041.0</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>0.864123</td>\n      <td>1929.0</td>\n    </tr>\n    <tr>\n      <td>1</td>\n      <td>2009-02-01</td>\n      <td>1929.0</td>\n      <td>374.109839</td>\n      <td>529.071208</td>\n      <td>748.219678</td>\n      <td>1183.039186</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>...</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>3721041.0</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>0.864123</td>\n      <td>1929.0</td>\n    </tr>\n    <tr>\n      <td>2</td>\n      <td>2009-03-01</td>\n      <td>1929.0</td>\n      <td>374.109839</td>\n      <td>529.071208</td>\n      <td>748.219678</td>\n      <td>1183.039186</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>...</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>3721041.0</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>0.864123</td>\n      <td>1929.0</td>\n    </tr>\n    <tr>\n      <td>3</td>\n      <td>2009-04-01</td>\n      <td>1929.0</td>\n      <td>374.109839</td>\n      <td>529.071208</td>\n      <td>748.219678</td>\n      <td>1183.039186</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>...</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>3721041.0</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>0.864123</td>\n      <td>3389.0</td>\n    </tr>\n    <tr>\n      <td>4</td>\n      <td>2009-05-01</td>\n      <td>1929.0</td>\n      <td>374.109839</td>\n      <td>529.071208</td>\n      <td>748.219678</td>\n      <td>1183.039186</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>...</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>3721041.0</td>\n      <td>1929.0</td>\n      <td>1929.0</td>\n      <td>0.864123</td>\n      <td>3389.0</td>\n    </tr>\n    <tr>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <td>153</td>\n      <td>2021-10-01</td>\n      <td>6264.0</td>\n      <td>1214.838792</td>\n      <td>1718.041496</td>\n      <td>2429.677584</td>\n      <td>3841.657573</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>...</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>39237696.0</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>-0.200946</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>154</td>\n      <td>2021-11-01</td>\n      <td>6264.0</td>\n      <td>1214.838792</td>\n      <td>1718.041496</td>\n      <td>2429.677584</td>\n      <td>3841.657573</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>...</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>39237696.0</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>-0.200946</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>155</td>\n      <td>2021-12-01</td>\n      <td>6264.0</td>\n      <td>1214.838792</td>\n      <td>1718.041496</td>\n      <td>2429.677584</td>\n      <td>3841.657573</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>...</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>39237696.0</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>-0.200946</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>156</td>\n      <td>2022-01-01</td>\n      <td>6264.0</td>\n      <td>1214.838792</td>\n      <td>1718.041496</td>\n      <td>2429.677584</td>\n      <td>3841.657573</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>...</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>39237696.0</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>-0.200946</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <td>157</td>\n      <td>2022-02-01</td>\n      <td>6264.0</td>\n      <td>1214.838792</td>\n      <td>1718.041496</td>\n      <td>2429.677584</td>\n      <td>3841.657573</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>...</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>39237696.0</td>\n      <td>6264.0</td>\n      <td>6264.0</td>\n      <td>-0.200946</td>\n      <td>NaN</td>\n    </tr>\n  </tbody>\n</table>\n<p>158 rows × 23 columns</p>\n</div>"},"execution_count":65}],"source":"full_data"},{"cell_type":"code","execution_count":66,"id":"special-small","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"0834B09BB1E545218510142C985554ED","trusted":true,"collapsed":false,"scrolled":false},"outputs":[],"source":"result_lr = generate_result(full_data,feature=feature,target=\"Gold_Reserve\")\ntrainset, testset = split_data(full_data)\nmultir_result=multi_model_eva(full_data, 'Gold_Reserve')"},{"cell_type":"code","execution_count":68,"id":"executive-justice","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"F4DB1E57837C4B4FB5E11F635AFC998D","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/F4DB1E57837C4B4FB5E11F635AFC998D/qtwwtvmzyy.png\">"}},{"output_type":"stream","text":"score: 12605.451565903903\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/F4DB1E57837C4B4FB5E11F635AFC998D/qtwwtv5fa1.png\">"}},{"output_type":"stream","text":"score: 0.0\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/F4DB1E57837C4B4FB5E11F635AFC998D/qtwwtvdbxs.png\">"}},{"output_type":"stream","text":"score: 71.97769898989803\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/F4DB1E57837C4B4FB5E11F635AFC998D/qtwwtvrqv8.png\">"}},{"output_type":"stream","text":"score: 0.0018814013969883465\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/F4DB1E57837C4B4FB5E11F635AFC998D/qtwwtvstdw.png\">"}},{"output_type":"stream","text":"score: 6403.149750056443\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/F4DB1E57837C4B4FB5E11F635AFC998D/qtwwtw9neb.png\">"}},{"output_type":"stream","text":"score: 2.384185791015625e-07\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}}],"source":"for i in multir_result:\n    visual(i,testset,\"Gold_Reserve\")\n    score_test(i,testset[\"Gold_Reserve\"])"},{"cell_type":"markdown","id":"fallen-marine","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"0DA9F6328A6940F299D1EACCFC1C69F5","trusted":true,"mdEditEnable":false},"source":"> #### 6、国家财政收入预测"},{"cell_type":"code","execution_count":69,"id":"senior-anime","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"CC766C5282334111A4CA3F2E2C093792","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/CC766C5282334111A4CA3F2E2C093792/qtwwvvqhxu.png\">"}},{"output_type":"stream","text":"score: 2675686.931864131\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/CC766C5282334111A4CA3F2E2C093792/qtwwvvdidt.png\">"}},{"output_type":"stream","text":"score: 0.0\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/CC766C5282334111A4CA3F2E2C093792/qtwwvwedm5.png\">"}},{"output_type":"stream","text":"score: 1495852.3326924352\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/CC766C5282334111A4CA3F2E2C093792/qtwwvwranp.png\">"}},{"output_type":"stream","text":"score: 336588.47864635166\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/CC766C5282334111A4CA3F2E2C093792/qtwwvwrghh.png\">"}},{"output_type":"stream","text":"score: 2625929.810656211\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/CC766C5282334111A4CA3F2E2C093792/qtwwvwlhc8.png\">"}},{"output_type":"stream","text":"score: 1577.9818432430707\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}}],"source":"file_labels=[\"Current_Export\",\"Current_Import\",\"M2\",\"M1\",\"M0\",\"FE_Reserve\",\"Gold_Reserve\",\"Fis_Current_Month_Value\",\"Nation_Current_Month\",\"City_Current_Month\",\"Country_Current_Month\"]\nfile_path=\"base_Fis_Current_Month_Value.csv\"\ndataset=pd.read_csv(\"./特征工程/\"+file_path)\ndataset[\"Month\"]=pd.to_datetime(dataset[\"Month\"])\ndataset=dataset.set_index(\"Month\")\nfeature=[ i for i in dataset.columns  if i not in [\"Month\",\"Fis_Current_Month_Value\"]]\ndata=dataset[feature].shift(12)\ndata=data.dropna()\ntarge_data=pd.DataFrame(dataset[[\"Fis_Current_Month_Value\"]])\ntarge_data.reset_index(inplace=True)\nfull_data=pd.merge(data,targe_data,on=\"Month\")\nresult_lr = generate_result(full_data,feature=feature,target=\"Fis_Current_Month_Value\")\ntrainset, testset = split_data(full_data)\nmultir_result=multi_model_eva(full_data, 'Fis_Current_Month_Value')\nfor i in multir_result:\n    visual(i,testset,\"Fis_Current_Month_Value\")\n    score_test(i,testset[\"Fis_Current_Month_Value\"])"},{"metadata":{"id":"39B13552692148E4802BB1936B35EF08","notebookId":"60b349d74223f3001719c3bd","jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"trusted":true,"collapsed":false,"scrolled":false},"cell_type":"code","outputs":[{"output_type":"execute_result","metadata":{},"data":{"text/plain":"array([10773.85535484,     0.        , 10752.        , 16149.        ,\n       15539.        , 18504.        , 18549.        , 12043.        ,\n       14234.        , 17531.        , 10956.        ])"},"execution_count":71}],"source":"# 选择决策树模型\nmultir_result[1]","execution_count":71},{"cell_type":"markdown","id":"social-ribbon","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"C2F357915FB34A3CA4DD36B490C9E532","trusted":true,"mdEditEnable":false},"source":"#### 7、中国居民消费价格指数预测"},{"cell_type":"code","execution_count":72,"id":"beneficial-removal","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"5DE6FA46D52846198CE9AC196BCFE6B8","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/5DE6FA46D52846198CE9AC196BCFE6B8/qtwx455g1c.png\">"}},{"output_type":"stream","text":"score: 3.5172897544063306\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/5DE6FA46D52846198CE9AC196BCFE6B8/qtwx45ml5h.png\">"}},{"output_type":"stream","text":"score: 1.7080641237373804\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/5DE6FA46D52846198CE9AC196BCFE6B8/qtwx46cm14.png\">"}},{"output_type":"stream","text":"score: 2.660341651330528\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/5DE6FA46D52846198CE9AC196BCFE6B8/qtwx46f6xf.png\">"}},{"output_type":"stream","text":"score: 1.8644439028291857\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/5DE6FA46D52846198CE9AC196BCFE6B8/qtwx462kmu.png\">"}},{"output_type":"stream","text":"score: 3.210810037619882\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/5DE6FA46D52846198CE9AC196BCFE6B8/qtwx46z78t.png\">"}},{"output_type":"stream","text":"score: 1.7092441007247288\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}}],"source":"file_labels=[\"Current_Export\",\"Current_Import\",\"M2\",\"M1\",\"M0\",\"FE_Reserve\",\"Gold_Reserve\",\"Fis_Current_Month_Value\",\"Nation_Current_Month\",\"City_Current_Month\",\"Country_Current_Month\"]\nfile_path=\"base_Nation_Current_Month.csv\"\ndataset=pd.read_csv(\"./特征工程/\"+file_path)\ndataset[\"Month\"]=pd.to_datetime(dataset[\"Month\"])\ndataset=dataset.set_index(\"Month\")\nfeature=[ i for i in dataset.columns  if i not in [\"Month\",\"Nation_Current_Month\"]]\ndata=dataset[feature].shift(12)\ndata=data.dropna()\ntarge_data=pd.DataFrame(dataset[[\"Nation_Current_Month\"]])\ntarge_data.reset_index(inplace=True)\nfull_data=pd.merge(data,targe_data,on=\"Month\")\nresult_lr = generate_result(full_data,feature=feature,target=\"Nation_Current_Month\")\ntrainset, testset = split_data(full_data)\nmultir_result=multi_model_eva(full_data, 'Nation_Current_Month')\nfor i in multir_result:\n    visual(i,testset,\"Nation_Current_Month\")\n    score_test(i,testset[\"Nation_Current_Month\"])"},{"cell_type":"markdown","id":"seasonal-premises","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"A6B17A5C478C4DE293EC388D7050C02F","trusted":true,"mdEditEnable":false},"source":"使用最后一个xgb.XGBRegressor"},{"cell_type":"code","execution_count":75,"id":"prerequisite-designation","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"073AE40B9B7C4A2789654D6CC91C5FB0","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"execute_result","metadata":{},"data":{"text/plain":"array([102.75692 , 102.46655 , 101.96686 , 102.68619 , 102.30506 ,\n       102.30506 , 102.30506 , 101.86238 , 101.86238 , 103.198524,\n        99.616196], dtype=float32)"},"execution_count":75}],"source":"multir_result[5]"},{"cell_type":"markdown","id":"accessory-clark","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"5BC13189AF644B2E8BE9255CA43C5A1C","trusted":true,"mdEditEnable":false},"source":"#### 7、城市居民消费者价格指数预测"},{"cell_type":"code","execution_count":76,"id":"caring-merchant","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"5C46F2C1B09142A88128FD41D9D3C3C0","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/5C46F2C1B09142A88128FD41D9D3C3C0/qtwxbrq31j.png\">"}},{"output_type":"stream","text":"score: 2.9540450744070457\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/5C46F2C1B09142A88128FD41D9D3C3C0/qtwxbrfwwt.png\">"}},{"output_type":"stream","text":"score: 2.0544516800659696\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/5C46F2C1B09142A88128FD41D9D3C3C0/qtwxbs4vyg.png\">"}},{"output_type":"stream","text":"score: 2.1765367052162223\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/5C46F2C1B09142A88128FD41D9D3C3C0/qtwxbsoew3.png\">"}},{"output_type":"stream","text":"score: 2.1411073850660434\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/5C46F2C1B09142A88128FD41D9D3C3C0/qtwxbs5twb.png\">"}},{"output_type":"stream","text":"score: 2.579543463275471\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/5C46F2C1B09142A88128FD41D9D3C3C0/qtwxbshjby.png\">"}},{"output_type":"stream","text":"score: 2.0540750582738405\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}}],"source":"file_labels=[\"Current_Export\",\"Current_Import\",\"M2\",\"M1\",\"M0\",\"FE_Reserve\",\"Gold_Reserve\",\"Fis_Current_Month_Value\",\"Nation_Current_Month\",\"City_Current_Month\",\"Country_Current_Month\"]\nfile_path=\"base_City_Current_Month.csv\"\ndataset=pd.read_csv(\"./特征工程/\"+file_path)\ndataset[\"Month\"]=pd.to_datetime(dataset[\"Month\"])\ndataset=dataset.set_index(\"Month\")\nfeature=[ i for i in dataset.columns  if i not in [\"Month\",\"City_Current_Month\"]]\ndata=dataset[feature].shift(12)\ndata=data.dropna()\ntarge_data=pd.DataFrame(dataset[[\"City_Current_Month\"]])\ntarge_data.reset_index(inplace=True)\nfull_data=pd.merge(data,targe_data,on=\"Month\")\nresult_lr = generate_result(full_data,feature=feature,target=\"City_Current_Month\")\ntrainset, testset = split_data(full_data)\nmultir_result=multi_model_eva(full_data, 'City_Current_Month')\nfor i in multir_result:\n    visual(i,testset,\"City_Current_Month\")\n    score_test(i,testset[\"City_Current_Month\"])"},{"cell_type":"code","execution_count":78,"id":"arctic-cinema","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"0D19CB586503444D873B1BF1DF03501E","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"execute_result","metadata":{},"data":{"text/plain":"array([102.75714286, 102.46666667, 101.96666667, 102.69      ,\n       102.3       , 102.3       , 102.3       , 101.85      ,\n       101.85      , 103.2       ,  99.6       ])"},"execution_count":78}],"source":"# 决策树回归\nmultir_result[1]"},{"cell_type":"markdown","id":"superior-square","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"05BB9F6699A64059873E3C008A84F006","trusted":true,"mdEditEnable":false},"source":"#### 8、农村居民消费者价格指数"},{"cell_type":"code","execution_count":79,"id":"public-declaration","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"F3A433FD6B8C4AA3A602D9217090C54E","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/F3A433FD6B8C4AA3A602D9217090C54E/qtwxfk7nuz.png\">"}},{"output_type":"stream","text":"score: 5.577547356286884\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/F3A433FD6B8C4AA3A602D9217090C54E/qtwxfk740b.png\">"}},{"output_type":"stream","text":"score: 1.4196818181818094\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/F3A433FD6B8C4AA3A602D9217090C54E/qtwxfk39p5.png\">"}},{"output_type":"stream","text":"score: 2.239542496531138\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/F3A433FD6B8C4AA3A602D9217090C54E/qtwxfleb3l.png\">"}},{"output_type":"stream","text":"score: 1.999713582804258\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/F3A433FD6B8C4AA3A602D9217090C54E/qtwxflodba.png\">"}},{"output_type":"stream","text":"score: 4.997857739823814\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}},{"output_type":"display_data","metadata":{"needs_background":"light"},"data":{"text/plain":"<Figure size 720x288 with 1 Axes>","text/html":"<img src=\"https://cdn.kesci.com/upload/rt/F3A433FD6B8C4AA3A602D9217090C54E/qtwxfl2sh6.png\">"}},{"output_type":"stream","text":"score: 1.4338313933959292\n","name":"stdout"},{"output_type":"display_data","metadata":{},"data":{"text/plain":"<Figure size 720x288 with 0 Axes>"}}],"source":"file_labels=[\"Current_Export\",\"Current_Import\",\"M2\",\"M1\",\"M0\",\"FE_Reserve\",\"Gold_Reserve\",\"Fis_Current_Month_Value\",\"Nation_Current_Month\",\"City_Current_Month\",\"Country_Current_Month\"]\nfile_path=\"base_Country_Current_Month.csv\"\ndataset=pd.read_csv(\"./特征工程/\"+file_path)\ndataset[\"Month\"]=pd.to_datetime(dataset[\"Month\"])\ndataset=dataset.set_index(\"Month\")\nfeature=[ i for i in dataset.columns  if i not in [\"Month\",\"Country_Current_Month\"]]\ndata=dataset[feature].shift(12)\ndata=data.dropna()\ntarge_data=pd.DataFrame(dataset[[\"Country_Current_Month\"]])\ntarge_data.reset_index(inplace=True)\nfull_data=pd.merge(data,targe_data,on=\"Month\")\nresult_lr = generate_result(full_data,feature=feature,target=\"Country_Current_Month\")\ntrainset, testset = split_data(full_data)\nmultir_result=multi_model_eva(full_data, 'Country_Current_Month')\nfor i in multir_result:\n    visual(i,testset,\"Country_Current_Month\")\n    score_test(i,testset[\"Country_Current_Month\"])"},{"cell_type":"code","execution_count":80,"id":"north-cheat","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"7A98B5813C1E47238BEA453BC81ED735","trusted":true,"collapsed":false,"scrolled":false},"outputs":[{"output_type":"execute_result","metadata":{},"data":{"text/plain":"array([103.24, 104.4 , 104.2 , 104.3 , 103.  , 102.3 , 102.97, 103.2 ,\n       102.1 , 100.4 ,  99.2 ])"},"execution_count":80}],"source":"# 决策树回归\nmultir_result[1]"},{"cell_type":"code","execution_count":null,"id":"flush-balance","metadata":{"jupyter":{},"tags":[],"slideshow":{"slide_type":"slide"},"id":"1DE2E613002F42ECBBE50D8CD7B23E50","trusted":true},"outputs":[],"source":""}],"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python","nbconvert_exporter":"python","file_extension":".py","version":"3.5.2","pygments_lexer":"ipython3"}},"nbformat":4,"nbformat_minor":5}